forked from anahitasocial/anahita
Translation
Pavel Kulbakin edited this page Jan 12, 2014
·
3 revisions
Translation system of Anahita is originated from Joomla, but has some specific features. The following list outlines some key concepts:
- translation strings are put into *.ini files;
- basic translation functions are JText::_() and template helper @text();
- all original strings in ini must be in CAPITAL LETTERS though when called, strings can be of any case;
- packages defined in application can have translation, some files are automatically loaded if corresponding pieces activated, e.g. LOCALE.com_COMPONENT.ini, LOCALE.tpl_TEMPLATE.ini, LOCALE.mod_MODULE.ini;
- it is possible to define language overwrite file LOCALE.PIECE.overwrite.ini to alter some default translations introduced by core libraries components;
Anahita+ introduces support of plural forms to accomodate for cases when a phrase has declension based on numeral involved, i.e. ngettext equivalent.
Plural forms are listed in translation file with indexes (0 index correspond to a single form, subsequent ones to plural), e.g. for English
LIB-AN-RECORDS-AVAILABLE[0]=There is %s record available
LIB-AN-RECORDS-AVAILABLE[1]=There are %s records available
Some languages can have more than 1 plural form, e.g. Russian
LIB-AN-RECORDS-AVAILABLE[0]=Доступна %s запись
LIB-AN-RECORDS-AVAILABLE[1]=Доступно %s записи
LIB-AN-RECORDS-AVAILABLE[2]=Доступно %s записей
Translation functions respecting plural forms are JText::_n() and template helper @ntext(), they determine plural form index based on input number using predefined set of equations.