nicksnyder / go-i18n

Translate your Go program into multiple languages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Safe extract locales with new lines (\n)

xTCry opened this issue · comments

If the string has a newline character, a second slash is added during extraction \\n
This harms the final result of the translation

From

&i18n.Message{
	ID:    "ANY_MESSAGE",
	Other: "\nbar bar `{{.Prefix}} bar` bar bar bar!**\n\nfoo foo",
}

To

"ANY_MESSAGE" = "\\nbar bar `{{.Prefix}} bar` bar bar bar!**\\n\\nfoo foo"

How do I fix this so that a second slash isn't added every time?

Thanks for reporting! This should be fixed in v2.1.2