如果在特定区域设置中缺少翻译,如何配置i18n以使用en locale?

时间:2021-07-14 07:41:06

How to configure i18n to use en locale translation if translation is missing in specific locale?

如果在特定区域设置中缺少翻译,如何配置i18n以使用en locale翻译?

Currently translation missing message is inserted.

当前插入了翻译缺失的消息。

Im using RoR 3.1.

我使用RoR 3.1。

1 个解决方案

#1


13  

Found similar question

发现类似的问题

Here is the answer:

这是答案:

# application.rb

# rails will fallback to config.i18n.default_locale translation
config.i18n.fallbacks = true

# rails will fallback to en, no matter what is set as config.i18n.default_locale
config.i18n.fallbacks = [:en]

# fallbacks value can also be a hash - a map of fallbacks if you will
# missing translations of es and fr languages will fallback to english
# missing translations in german will fallback to french ('de' => 'fr')
config.i18n.fallbacks = {'es' => 'en', 'fr' => 'en', 'de' => 'fr'}

#1


13  

Found similar question

发现类似的问题

Here is the answer:

这是答案:

# application.rb

# rails will fallback to config.i18n.default_locale translation
config.i18n.fallbacks = true

# rails will fallback to en, no matter what is set as config.i18n.default_locale
config.i18n.fallbacks = [:en]

# fallbacks value can also be a hash - a map of fallbacks if you will
# missing translations of es and fr languages will fallback to english
# missing translations in german will fallback to french ('de' => 'fr')
config.i18n.fallbacks = {'es' => 'en', 'fr' => 'en', 'de' => 'fr'}