We started to add localization to Gjallar.
What we have done
Added the mechanism to translate phrases - to which you send #translated - based on the current Q2Session's #localeID,
- which has a default value defined in Q2Object >> initializeMissingDefaultSettings as 'en'.
- can be overridden in gjallar.ini [Localization] defaultLanguage
- customized per session with Q2Session >> localeID:
The translations are stored in Q2NaturalLanguageTranslator, so they do not mix with the translations in NaturalLanguageTranslator. You can read about the usage in the class comments.
This will be merged by Göran soon.
The other thing is a package called LocalizationTools. It's also in the repo. It contains two tools:
- LTLocalizationManager is a morphic tool for adapting the code to a localized version. Explicitly said: It helps you to spread #translated, #format:, (and #untranslated) messages in a package. It depends on AST and Shout.
- LTLanguageEditor is a seaside app for editing translation sets. It gets installed at the entrypoint /lang. It may need some higher version of scriptaculous (like 141)
We have class comments for these too.
What have to be done
Sprinkle all those #translated messages all over the code. Transform concatenated strings into #format:-ed ones. There's more than a thousand place to change in Gjallar. It seems to be an easy task, but we can introduce bugs by accident, so care should be taken.
Phrases receiving #translated message, but not having a translation in the translator's dictionary should be logged in a limited size, cycling list. So the translation process could be navigation driven.
Put a "hack" into seaside to store stacks of recent string renderings, so their origins can be revealed.
Levente & Balázs