0
現在我有模型Territory - id, territory_title_locale_key
在我的數據庫如何做出更好的Rails的I18n(整理和翻譯搜索)
我有en.yml
和ru.yml
文件與翻譯。將來,我想添加更多的區域設置。現在我展示價值 - I18n.t("translate_path.#{territory.territory_title_locale_key}")
但我無法通過標題的價值快速搜索區域並按標題排序。
我看到的變體:
更改數據庫Territory - id, title, en, ru, es, ...
始終鍵入Territory.where(my_condition).select("#{I18n.locale} as title")
(爲每個新的語言環境,我必須添加列到數據庫)。
或者創建附加表格Translations
,其中包含多態引用,翻譯和locale_ids。
如何讓它變得更好?