gettext_i18n_rails_js icon indicating copy to clipboard operation
gettext_i18n_rails_js copied to clipboard

Generating app.js with \n

Open filipeperdigaosousa opened this issue 5 years ago • 0 comments

Hello.

I'm with a problem when moving my .po files into app.js files using gettext:po_to_json method.

For example:

I have the following string in a JS file

__("E.g. I've been working as a social entrepreneur  for the past 5 years. \nBased in Portugal, I’m a Co-Founder of two Social…  ")

When I run gettext:find it generates something like:

msgid ""
"E.g. I've been working as a social entrepreneur  for the past 5 years. \n"
"Based in Portugal, I’m a Co-Founder of two Social…  "
msgstr ""

But when I move into the app.js file, the new line is being escaped producing this:

"E.g. I've been working as a social entrepreneur  for the past 5 years. \\nBased in Portugal, I’m a Co-Founder of two Social…  ":[" translation text "]

which has 2 backslashes, and the translation is not found because the key used in JS file is different from the key in JS file

Someone can help me with this issue?

Thanks in advance

filipeperdigaosousa avatar Oct 30 '19 22:10 filipeperdigaosousa