I18n (english)

Z Freenetis Wiki
Přejít na: navigace, hledání


Internationalization in FreenetISu covers two areas:

  • Strings that are contained in the source code - this is done using the language files in i18n
  • Strings in the database - string in the database is usually not necessary to translate. The exceptions are enumerated types - eg types of members, facilities, contacts that you can edit through a web interface. Since the installation Freenetis contains basic values ​​for these types, it is necessary for them to think about internationalization.

Enumerated types are implemented using two tables:

+ Enum_types: id! type_id! value - | 1 (eg type = member) | | Applicant - | 1 | | Regular member - | 1 | | Honorary member - | 2 (eg = contact type) | | Phone - | 2 | | ICQ - | 2 | | Skype

Table enum_types contains a listing of all types in the default language (here English is selected)

Translations for each row of enum_types we obtain from the table translations:

+ Translations: id! original_term! translated_term! lang - | Regular member | | Řádný člen | | cs - | Regular member | | Regular member | | en - | Regular member | | ordentlich Mitglied | | de - | Phone | | Phone | | cs - | Phone | | Phone | | de -

Due to the fact that both tables are interrelated by key, you can use the table translations and translation of terms from other tables than enum_types.

Common query to get id and the corresponding strings for a particular language types of members (type_id = 1):

SELECT enum_types.id, IFNULL(translations.translated_term,enum_types.value) as value FROM enum_types
LEFT JOIN translations on enum_types.value = translations.original_term
WHERE enum_types.type_id=1 AND translations.lang="cs"