This
replaces gettext??™s harvesting phase and uses the strings themselves from your application
to determine what needs to be translated.
When we do add a translation to the database, it works as expected:
Locale.set 'es-MX'
Locale.set_translation 'Hello, World!', '??Hola, mundo!'
puts "Hello, World!".t
# >> ??Hola, mundo!
Globalize also tries to capture all of the Rails error messages and add them to the
table, to be localized. When they have been translated, Globalize will intercept them
and replace them depending on the current locale.
Globalize includes a collection of data about the world??™s languages, to minimize the
amount rote translation of common data. Data provided includes the following:
??? ISO codes, English names, and native names for each language (for example,
???FR,??? ???French,??? and ???Fran?§ais???).
??? Pluralization rules (for example, is ???0 items??? inflected the same as ???1 item,??? or
the same as ???2 items,??? as in English?).
??? Writing direction (left-to-right or right-to-left).
??? Date, currency, and number format (for example, ???12,345.67??? versus ???12.345,67???)
for each locale.
??? Translation of date information (weekday and month names) for most languages.
256 | Chapter 8: i18n and L10n
Locale-Specific Settings
Beyond simple translation, there are plenty more locale-specific issues. Different
locales, even within the same language, can have vastly different conventions for representing
dates, times, currency, and numbers.
Pages:
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399