Rootical V. Rootical V. - 2 months ago 17
YAML Question

How to break lines in .yml localization files on rails?

I have a terms.en.yml file with some localization, for example:

en:
devise:
registrations:
terms:
text: 'This agreement was written in English (US). To the extent any translated version of this agreement conflicts with the English version, the English version controls. Please note that Section 16 contains certain changes to the general terms for users outside the United States.\n\ Some new line'


How could i break a line or create a paragraph there?

Here`s some info but it did not helped to me,i had been doing something wrong. http://yaml.org/spec/1.1/#b-paragraph-separator

Answer

This works for me:

en:
  hello: "Hello world"
  bye: |
    Bye!
    See you!
  error: >
    Something happend.
    Try later.

Usage:

irb(main):001:0> I18n.t 'bye'
=> "Bye!\nSee you!\n"
irb(main):002:0> I18n.t 'error'
=> "Something happend. Try later.\n"
Comments