Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
dev:l10n [2007/05/13 19:02] fran English, typos, Link to User Docs |
dev:l10n [2009/07/06 20:36] (current) |
||
---|---|---|---|
Line 4: | Line 4: | ||
"The gettext functions implement an NLS (Native Language Support) | "The gettext functions implement an NLS (Native Language Support) | ||
API which can be used to internationalize your PHP applications" | API which can be used to internationalize your PHP applications" | ||
+ | |||
Line 17: | Line 18: | ||
localization enabled | localization enabled | ||
- | < | + | - < |
</ | </ | ||
Line 26: | Line 27: | ||
<? | <? | ||
</ | </ | ||
+ | |||
Line 64: | Line 66: | ||
</ | </ | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== gettext Best Practices ===== | ||
+ | |||
+ | * 1. Please make sure gettext contain only word phrases. | ||
+ | |||
+ | <code php> | ||
+ | e.g: | ||
+ | _('< | ||
+ | |||
+ | this should be, | ||
+ | echo "< | ||
+ | </ | ||
+ | |||
+ | * 2. If there are html tags which we have to put within word phrase make sure to separate it from gettext. (see above example) | ||
+ | |||
+ | * 3. When writing paragraph within gettext make sure line brakes are not there (In this case line breaks are behave in different ways in different editors for instance Eclipse put line break when you press enter but Qunata won't put line break but it'll wrap it). | ||
+ | |||
+ | <code php> | ||
+ | e.g: | ||
+ | Eclipse behave as follows | ||
+ | _("The SAHANA Disaster Victim Registry is a central online repository " . | ||
+ | "where information on all the disaster victims can be stored. Information like name, age" . | ||
+ | ", contact number, id card number, religion, race, displaced location, current location and other ") | ||
+ | |||
+ | This paragraph appears in sahana.po file in separate lines,not in a paragraph.Solution for Eclipse IDE users is | ||
+ | writing the paragraph in same line. | ||
+ | |||
+ | Quanta will wrap this paragraph and appears in sahana.po file as a paragraph, | ||
+ | |||
+ | </ | ||
+ | |||
+ | * 4. Html special characters should separate from gettext. | ||
+ | * 5. Beware of quotation marks, please put html special characters for quotation marks(Quotation marks are always bother developers :-)) | ||
+ | |||
+ | |||
+ | Rule of thumb is to keep contain of gettext as simple as possible | ||
===== Database Localization ===== | ===== Database Localization ===== | ||
Line 134: | Line 175: | ||
Sahana now has a web interface for the language translation using the GNU Gettext framework. | Sahana now has a web interface for the language translation using the GNU Gettext framework. | ||
- | Currently using this interface the user can [ extract ] the strings that needs to be translated and create the template file for the translation, | + | Using this interface the user can [ extract ] the strings that needs to be translated and create the template file for the translation, |
- | + | ||
- | ===== Configuration ===== | + | |
- | + | ||
- | For the web interface to work you have to give read/write permission to the ' | + | |
- | You also have to have gettext installed and have ' | + | |
- | You have to have the gettext extension in php for the translation to work. Otherwise you will only see the strings in the base language, which is usually en_US (English). | + | |
- | + | ||
- | ===== Translating Sahana ===== | + | |
- | + | ||
- | Also see the [[doc: | + | |
- | + | ||
- | You can access the translation interface by going to ' | + | |
- | Before doing the translation make sure you have selected the correct locale for your language. You can do that by going to ' | + | |
- | + | ||
- | The normal way of doing a translation would be, | + | |
- | * Load the existing list | + | |
- | Should be loaded at the start. If not Click the 'Load Existing List' button. | + | |
- | + | ||
- | * Do the translation. | + | |
- | The translation is done by entering the translated string for the ' | + | |
- | e.g: | + | |
- | + | ||
- | #: ../ | + | |
- | #: ../ | + | |
- | msgid "* Description:" | + | |
- | msgstr "* විස්තර:" | + | |
- | + | ||
- | + | ||
- | + | ||
- | * Save the translated list | + | |
- | After doing the translation save the translated list. Press the ' | + | |
- | + | ||
- | * After saving the translated list you have to compile the translated PO file in to a MO file which is ultimately used in the localization of Sahana. This can be done using the ' | + | |
+ | For details, see the User Docs on [[doc: |