since my 1st internship, sept.2006 (that was around rails 1.0) • R&D engineer at Faveod • We develop, market and sell our technology Faveod Designer • Faveod Designer helps you create complex web applications faster • You describe your specs and it just works. Easier, better, faster, stronger http://www.linkedin.com/in/sylvainabelard
app global • GetText is a UNIX standard • How? • Translators’ horror stories • Show me some code! • What? • Tools around GetText • Alternatives GNU GetText: GetText’s Never Useless
one translation? • Grammar: number, gender, case • Number looks simple enough: car/cars, but child/children and person/people • Many languages have a difference for one, two and more. Some have even more. • Gender is often masculine, feminine or neuter (and rarely intuitive) • Some languages have differences for inanimate and animate (personal or impersonal) • Conjugation: person, tense, mood, voice, aspect • ... ok, let’s not even try this
560x less memory • thread safety • simple, clean namespace • Backends • .mo and .po files • .yml • DB • ... code your own Michael Grosser’s FastGetText!
key / values per language • Many great tools for PO files, including an emacs mode • Setting the locale • You select the locale for each use (in Rails: request-wide, it’s thread-safe) • Setup How to GetText part 1 GetText.locale = "fr" init_gettext "my_app" I18n.supported_locales = ["en", "fr", "de", "ar", "ru"] # better: make it guess from existing files I18n.default_locale = "fr" # en is the default
Variables, the printf way • _("string with %s") % "arg" • _("string with %s and %s") % ["arg1", "arg2"] • Variables, the right way • _("Could not find this %{obj}") % {:obj => _("stuff")} • Now on to our horror stories How to GetText part II
This will flag unused translations as obsolete and try to guess new ones (« fuzzy ») • Edit your files # translator comments #. extracted comments #: reference #, flag msgid "One file removed" msgid_plural "%d files removed" msgstr[0] "%d slika uklonjenih" msgstr[1] "%d slika uklonjenih" msgstr[2] "%d slika uklonjenih" • Update your translations • rake makemo Don’t do this manually, use tools.