lvgl / lv_i18n

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

Unescaping broken #50

Closed bubeck closed 1 year ago

bubeck commented 1 year 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 1 year ago

What exactly is obviously wrong?

bubeck commented 1 year 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 1 year ago

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

bubeck commented 1 year ago

OK, you are right. I am sorry

puzrin commented 1 year ago

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

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