Multi language page generator module
This project creates language specific static HTML page from a HTML page that
contains information in a certain language.
The Module will test the charset metadata of the page to decide what language should be used.
The module will access a database table with two column table where the first column is the charset code (e.g. iso-8859-1) and the language code (e.g. en) the language code should handle 2 letters only (ignore variants #8230;)
If UTF-8 encoding is used the module should try figure out the language of the page from the language tags in the HTML spec, if those are missing then the module should use the
A default language value he received on initialization
The initialization also receives DBI connection string
(e.g. $i18n = I18N->new(default_language => #8216;en #8217;, dbh => #8216;dbi:ODBC:I18N #8217;) )
The module includes pre-processing method that its input is an HTML filename, the method reads the HTML file and find all language specific text in the HTML, the output will be inserted to a SQL Database table in the following format
The function will give every text a Field_id,
The Field_text will contain the text
And Language_id will be set according to the HTML encoding or language
For this file
Design and specification
Implementation, debugging, and testing services
The database will hold something like this
Field_id, Field_text, Language_id
1,Design and specification, en
2,Implementation, debugging, en
3,and testing services, en
Image Alt attributes and tags tool tips should be considered as text
Every time you call the pre-processing method with new page the database grows and grows
It is not allowed that two pages will have the same Field_id.
If the pre-processing method input is a directory name then it will run on all HTML and HTM files in the directory.
The module will have an add language method #8211; that when called it will had a new entry for the requested language
If the module is called with module->AddLanguage( #8216;fr #8217;) the above database will become
Field_id Field_text Language_id
1 Design and specification en
2 Implementation, debugging, en
3 and testing services en
The module will have a #8220;not translated yet #8221; method that returns a reference to a list of
All Field_ids in a specific language that are empty (not translated yet)
The function input is a language_id (e.g. en, fr etc #8230;.)
In the above example the return value for this method with #8216;fr #8217; input will be [1,2,3]
The module will have a generate pages method, the input for this method should be
Directory name. This method creates sub directory for every language and put
All the pages translated according to the database content
e.g. for the above database and a directory /user/data/i18n/ it will create to sub directories
/user/data/i18n/en/ and /user/data/i18n/fr/
The method will replace all the original text string with the translated ones from the data base.
If some strings in the database are empty then it will put the original text surrounded by a link original text
Where the $link is an input parameter for the module the YYYY is the Field_id and the ZZ is the language generated
The generate pages method will insert dir= #8221;rtl #8221; attribute In the body tag and ,append rtl to the image paths (i.e. if image path was Src= #8221;img/[url removed, login to view] #8221; it will be Src= #8221;imgrtl/[url removed, login to view] #8221; and will convert align= #8221;right #8221; to align = #8220;left #8221; if the direction setting is #8216;rtl #8217;. The change should be made only to generated pages when the language is either #8216;ar #8217; or #8216;he #8217;.
The module should be OO perl module
The module should support all code pages and UTF-8 as well
The module should be well documented and easy to maintain, you should not used third party software that has a restricting license that will not enable me to distribute this module
we should get all the source code documented and we get all copyrights and we can do whatever we want with the code including changing it and reselling it, eating it ..:-)
the module should be compatible with ms windows and all the module dependencies as well, it must be based only on open source code no special modules that cost money or limit our ability to distribute the software developed are allowed !