lvgl / lv_i18n

Internationalization (i18n) for LVGL
MIT License
62 stars 17 forks source link

Unescaping broken #50

Closed bubeck closed 2 years ago

bubeck commented 2 years ago

I am using lv_i18n latest version "f871e05" from GitHub (not latest official release). When using this key with the translation,

"Type this passcode\n\n%lu\n\non the other device.": "Bitte das Passcode\n\n%lu\n\nauf dem anderen Geraet eingeben."

and a following "lv_i18n compile" gives a correct result:

{"Type this passcode\n\n%lu\n\non the other device.", "Bitte das Passcode\n\n%lu\n\nauf dem anderen Geraet eingeben."},

However, if you redo "lv_i18n extract" then the above translation gets changed to, which is obviously wrong:

  "Type this passcode\n\n%lu\n\non the other device.": |-
    Bitte das Passcode

    %lu

    auf dem anderen Geraet eingeben.

Please handle "\n" and other escape sequences right.

puzrin commented 2 years ago

What exactly is obviously wrong?

bubeck commented 2 years ago

The translation is broken in many lines (at each \n) and there is a "|-" at the begining:

  "Type this passcode\n\n%lu\n\non the other device.": |-
    Bitte das Passcode

    %lu

    auf dem anderen Geraet eingeben.

Also it is loosing quotes at start and end of string.

puzrin commented 2 years ago

Yaml supports multiline formats, with and without quotes. Please read spec and play with online demos of yaml.

bubeck commented 2 years ago

OK, you are right. I am sorry

puzrin commented 2 years ago

http://nodeca.github.io/js-yaml/#yaml=IlR5cGUgdGhpcyBwYXNzY29kZVxuXG4lbHVcblxub24gdGhlIG90aGVyIGRldmljZS4iOiB8LQogICAgQml0dGUgZGFzIFBhc3Njb2RlCgogICAgJWx1CgogICAgYXVmIGRlbSBhbmRlcmVuIEdlcmFldCBlaW5nZWJlbi4K

Online demo for quick-checks, if you see something "strange" in yaml