cockpit-project / cockpit-files

A Featureful File Browser for Cockpit (Modernized and tested version of https://github.com/45Drives/cockpit-navigator)
GNU Lesser General Public License v2.1
46 stars 26 forks source link

po: Don't mark JavaScript strings as c-format #586

Closed martinpitt closed 3 months ago

martinpitt commented 3 months ago

We don't use printf-style C format macros like "%s" in the JavaScript code, at least not for translations. But xgettext interprets the "$0% Free" in pkg/kubernetes/scripts/nodes.js as C format string, which confuses translation tools and blocks the proper translation of this string.

As there doesn't seem to be a way to change the --keyword=ngettext argument to do that, just filter out the c-format tag with sed.

Taken from https://github.com/cockpit-project/cockpit/commit/449d76c0e6d9


See https://github.com/cockpit-project/cockpit-podman/issues/1712 and https://github.com/cockpit-project/cockpit-podman/pull/1763 .

--- tmp/files.pot
+++ po/files.pot
@@ -22,7 +22,7 @@ msgstr ""
 "#-#-#-#-#  files.js.pot (PACKAGE VERSION)  #-#-#-#-#\n"
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-06-21 14:42+0200\n"
+"POT-Creation-Date: 2024-06-21 14:44+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -40,7 +40,7 @@ msgstr ""
 "#-#-#-#-#  files.metainfo.pot (PACKAGE VERSION)  #-#-#-#-#\n"
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2024-06-21 14:42+0200\n"
+"POT-Creation-Date: 2024-06-21 14:44+0200\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@li.org>\n"
@@ -420,8 +420,8 @@ msgstr ""
 msgid "Upload"
 msgstr ""

+#
 #: src/upload-button.tsx:319
-#, c-format
 msgid "Upload $0% completed"
 msgstr ""
jelly commented 3 months ago

So this needs to go into files as well?

martinpitt commented 3 months ago

@jelly Not sure what you mean, this is files?

martinpitt commented 3 months ago

Marking as release blocker, as this breaks an actual string (same in podman). The other projects didn't run into that issue, so not a release blocker for them.

allisonkarlitskaya commented 3 months ago

I don't like this, but @martinpitt has spent enough time researching alternatives on this, without success (including changing the language, and trying to play with flags parameters). Let's just go with it.