Translation file failed check

I sometimes do translation offline. Download from weblate, translate using POEdit, then upload back to weblate. Translation review are also much easier done that way. Problem is POEdit show 2 lines with problem. So I try to verify using msgfmt (msgfmt -vco /dev/null collabora-online-ui-id.po). It also display 2 fatal errors:

collabora-online-ui-id.po:2800: 'msgstr' is not a valid JavaScript format string, unlike 'msgid'. Reason: In the directive number 1, the character 't' is not a valid conversion specifier.
collabora-online-ui-id.po:2807: 'msgstr' is not a valid JavaScript format string, unlike 'msgid'. Reason: In the directive number 1, the character 't' is not a valid conversion specifier.
msgfmt: found 2 fatal errors
600 translated messages.

Is this know problem?

Replacing %0 with %%0 or {%0} will pass check.

1 Like

Hey @andika, welcome to the forum + thanks for helping translate! :slight_smile:

So, according to you response, seems like you solved your problem?

  • What language were you translating?
  • Do you happen to know the exact lines with 2 “fatal errors”?
  • What were the bad strings?

Do you happen to know if this occurs in other languages on Weblate too?

Hello @Tex.

I translate into Indonesian.
Line number and content of collabora-online-ui.po:

2796 #: src/map/handler/Map.FileInserter.js:105
2797 #, javascript-format
2798 msgid ""
2799 "The file of type: %0 cannot be uploaded to server since the file has no name"
2800 msgstr ""
2801 "Berkas bertipe: %0 tidak dapat diunggah ke server karena berkas tidak memiliki "
2802 "nama"
2803 
2804 #: src/map/handler/Map.FileInserter.js:107
2805 #, javascript-format 
2806 msgid "The file of type: %0 cannot be uploaded to server since the file is empty"
2807 msgstr "Berkas bertipe: %0 tidak dapat diunggah ke server karena berkas kosong"

I did not solve that problem because I can only change translation strings, while the problem need to be solved by changing source string.

Andika

1 Like

Hi Andika,

Thanks for reporting this. Luckily it’s just a minor annoyance, COOL does not use gettext, we replace the literal ‘%0’ to a string by the code. But it does not have be ‘%0’. It could be ‘$0’ or ‘{0}’, whatever we like. So possibly, I’ll change this, not to annoy people who check their po files with msgfmt command. It’s not only about changing source strings, it requires changes in the surrounding code, too.

1 Like

FYI, I replaced the placeholders all over the project. Unify placeholder style by timar · Pull Request #9356 · CollaboraOnline/online · GitHub

2 Likes