internationalization - How to escape colon : in rails i18n? -


here line in view:

<%= f.input :comm_date, :label => "hello:", :as => :string %> 

the regular i18n file has format as:

  hello : 'aloha' 

in i18n yml file, want translate "hello:" as, example, "aloha:". can escape colon : doing below?

'hello:' : 'aloha:'

or what's right way escape colon?

the gem using, simple_form, other similar ones such formtastic, allow using translation files (e.g. en.yml) defining label text.

you can see translation file expectations simple_form documentation. using example, you'd need 2 translations, this, assuming model called communication:

en.yml

en:   simple_form:     labels:       communication:         comm_date: "hello:" 

olelo.yml

olelo:   simple_form:     labels:       communication:         comm_date: "aloha:" 

and view be

<%= f.input :comm_date, :as => :string %>  

no need provide value :label option.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -