Alternatively, we could
build an administrative interface with Rails that allows our translators to log in, see
any text that needs to be translated, and input translations that are used immediately.
For now, we will stick with the simple approach.
Before we can enter the translations, we need to generate the list of needed translations.
Browse to /people?locale=es and click around until you have visited all of the
pages. (As ActionView doesn??™t render templates until they are needed, the String#t
methods will not be called until the page is actually needed.) This will populate the
list of required translations, which we can easily extract at the Rails console. All we
need to do is tell Globalize that we are translating into Mexican Spanish, and then
find the translations that have no corresponding Spanish text:
Rails L10n | 267
>> Locale.set 'es-MX'
>> pp ViewTranslation.find(:all, :conditions =>
['text IS NULL AND language_id = ?', Locale.language.id]).map(&:tr_key)
["Address Book",
"New person",
"Phone Numbers",
"Home",
"Office",
"Mobile",
"Address",
"New Person",
"First name",
"Last name",
"Home phone",
"Office phone",
"Mobile phone",
"Country",
"Save",
"Address book is empty."]
We can take this list to our translator, get the translations back, and use the console
(or an administrative interface) to enter translations. This script, run at the Rails console,
will set up our translations.
Pages:
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410