I18N: INternationalisation

General

The purpose of this RFC is discuss the integration of PEAR::Translation2 and PEAR::I18Nv2 into various parts of seagull.

PEAR Packages

  • PEAR Category Internationalisation
  • http://pear.php.net/package/Translation2
  • http://pear.php.net/package/I18Nv2

Translation Types

  • GUI (Current translations)
  • Category
  • Content
  • Error Message
  • Navigation
  • Template

Content Translations

Translating

  • Add - User will use their default language for adding items with an option to provide additional area for other languages.
  • Edit - To allow translations to be easily managed a translator will select a reference language from a select box. Then they will select the target language(s) from a multiple select box. If the translator leave the reference language blank the language in their preferences will be used.

Search Engines

Content items may need to display a list of links for each available translation. This will allow search engines to index all of the content in multiple languages.

There needs to be a link manger to provide the proper internal or external link depending on locale. If there is not a link available for the current locale a link for the sites default language will be returned. A new item type can be created to handle this.

Template Translations

PEAR::HTML_Flexy will use Translation2 to replace User Defined Translation Blocks (UDTB)

o For blocks that include HTML and flexytags - that the autoparser cant pick up, or you want to use 'placeholders' that are a bit more verbose. o These blocks are translated/replaced, prior to Tag tokenizing (so the translation can include tags - variable markers or HTML)

Data Storage

Translation2 offers two ways to store tranlsations.

  • Separate Table for each language.
  • Create an additional column for each language in an existing table.

Data Stores

  • Single - Generate a single translation table with a column for each installed languages.
  • Multiple - Generate individual translation tables for each installed language.
  • Single+Multiple - Generate a single translation table to store application specific data (translation_app) using seperate columns for each installed language and generate individual tables for each installed language to store content translations (translation_content). *
  • Extended Multiple - Generate individual tables for each installed language for application data (translation_app) and content data(translation_content). *

* Currently undeveloped.

URL Shortcut

Create a php array that maps url shortcuts to their longer name. Examples:

  • http://www.example.com/article/frmArticleID/1/lang/de
  • http://www.example.com/article/frmArticleID/1/lang/en
  • http://www.example.com/article/frmArticleID/1/lang/pl

Here you can find two-letter Language Codes.

Language Negotiation

Use SGL_Locale (PEAR::I18Nv2 wrapper) to negotiate the language. Using the set languages in the browser first, then the prefered language if a user is logged in and last the default language set in the site preferences.

Caching

All translations will be cached using PEAR::Translation2's Cache_Lite Decorator.

Flags

Sodipodi has a flag-gallery with nearly every flag in the world, with preview as png. http://www.sodipodi.com/index.php3?section=clipart see also: http://www.openclipart.org/cgi-bin/navigate/signs_and_symbols/flags

How other translate

http://drupal.org/node/5503#8413 drupal is definitely worth an install, you'll probably like the way they translate stuff.

Roadmap

  • Create additional storage drivers
  • Modify Installer to allow selection of language to install
  • Move current application translations into db (during install)
  • Translation2 Wrapper
  • Implemant use of wrapper
    1. SGL_String
    2. SimpleNav
    3. CategoryMgr
    4. PageMgr
    5. MaintenanceMgr
    6. SGL_Item.