Orchard Harvest 2017–Localization

Benedek is one of the founders of Lombiq, and the caretaker of Orchard localization. Application localization requires taking into account cultural differences such as gender, formal vs informal, pluralization, right to left, verbosity, accents, etc. In Orchard, all localizable strings should be wrapped in T() calls. That is enough to make the string localizable in PO files. Some strings can contain placeholders, such as T("Hello, I’m from {0}."). You can use the Vandelay Industries module’s translation extraction feature to extract all the T strings from a module into po files. The module produces a zip archive that contains the layout of localization files that you’d unzip into the site in order to install it. To localize, you can copy any po file from its en-us directory to a new directory for the new culture, then translate the strings inside.

Manual translation of po files is not the only option, however. The Orchard community is crowd-sourcing and centralizing translation of the core platform and of the most common modules on Crowdin. Benedek uploads po files for all new releases of Orchard onto the site, then anybody can contribute translations, with machine translation suggestions from Crowdin, and proofread existing translations. The resulting translated strings can be downloaded as an archive that can be unzipped over the web site. You can then add cultures in Orchard settings, switch the default culture and start using the new translations.

Now that we know how to localize static strings defined in modules, we can look at how to translate contents. Translating contents can be challenging, especially in cases where relationships between items exist, such as taxonomies, or media library picker fields. All the tools are in place in Orchard for this to work however, with the possibility to specify items as culture neutral, cloning capabilities, and culture matching of associated items. Navigation is still work in progress but is following the same path.

A guide to localization is available from http://orchardproject.net/localization

In questions, bulk translation was mentioned, for which the q42 module is very useful.

Jorge also mentioned how the en-us translation can be used to hack the site into displaying a different string in English than what’s specified in code.

No Comments