Inspiring people to share co-lead of TYPO3 Neos and Flow 35 years old lives in Lübeck, Germany 1 wife, 3 sons, 1 espresso machine likes canoeing and climbing Karsten Dambekalns
Inspiring people to share Basics i18n is the process of making software localizable L10n means actually • formatting dates, numbers, … • translating text • adjusting other things (images, …)
Inspiring people to share Locale Locale instances encapsulate a locale identifier Locales define the language and formats to use Locales form a hierarchy • en is a parent of en_US which is a parent of en_US_POSIX • Thus items for the en_US locale that do not exist, will be used from the en locale if available
Inspiring people to share What you need A way to translate in templates A way to store translations of labels Formatters for dates, numbers, … An API for use in PHP
Inspiring people to share f:translate the way of translating you will use most
{f:translate(id: 'my.label.1')} translation by label is possible, but discouraged • less reliable than id-based translation • prohibits changes to the original label
Inspiring people to share f:form.select has translation support built in translate="{by: 'id'}" /> translate="{by: 'id', prefix: 'payment.options.', package: 'Acme.Demo.Translations'}" />
Inspiring people to share Message catalogs XML Localisation Interchange File Format is the standard we use Looked up in well-known location Resources/ Private/ Translations/ / .xlf
Inspiring people to share XLIFF basics An XLIFF file can hold translations for one locale It contains one or more elements corresponding to a source Localizable data is stored in elements which contain a element to store the source text and a (non-mandatory) element to store the translated text
Inspiring people to share i18n configuration Default locale can be set in Settings.yaml Locale fallback rules are configurable TYPO3: Flow: i18n: defaultLocale: de fallbackRule: strict: FALSE order: [lv, en]
Inspiring people to share i18n configuration Default locale can be set in Settings.yaml Locale fallback rules are configurable TYPO3: Flow: i18n: defaultLocale: de fallbackRule: strict: FALSE order: [lv, en]
Inspiring people to share Plural forms The CLDR defines six plural forms • zero, one, two, few, many, other Different languages use more or less forms • singular and plurals for English • one, few and other for Polish • only other for Japanese
Inspiring people to share L10n of resources Resources can be localized as well The locale is part of the name • Image.png • Image.de.png • Image.lv.png Usable for all resources • Images, templates, …
Inspiring people to share Tips & Tricks Split catalogs at logical points Try to use.a.clever.id.system Avoid hardcoded labels from the start To change "original" labels simply translate to "original" language
Inspiring people to share Known issues L10n support in f:resource VH pending in review Fallback per label is missing, currently only done per catalog Overriding parts of catalogs is missing Model translation still missing
Inspiring people to share Thank You! These slides can be found at: http://speakerdeck.com/kdambekalns http://slideshare.net/kfish Give me feedback: [email protected] | [email protected] Download Flow: http://flow.typo3.org Follow me on twitter: @kdambekalns Support me using