开发者

How to define localization for names starting with a dot in Rail3?

开发者 https://www.devze.com 2023-03-02 23:05 出处:网络
Rails3 + HAML generated templated contains localization. For example to translate \'show\' %td.action= link_to t(\'show\'), tidbit

Rails3 + HAML generated templated contains localization. For example to translate 'show'

%td.action= link_to t('show'), tidbit

I just have to add follwing to en.yml

en:
  show: "Show"

but when attributes to be translated starts with a dot as in the case of '.newtidbit', this does not work.

%p= link_to t('.new_tidbit'), new_tidbi开发者_高级运维t_path


If you prefix your translate keys with a period it's going to do a "lazy lookup". So you'll have to define the translation under your controller and view name such as:

en:
  tidbits:
    index:
      new_tidbit: New Tidbit

(I'm guessing on the name of your controller and view file of course but you get the idea)

0

精彩评论

暂无评论...
验证码 换一张
取 消