-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
po: Don't mark JavaScript strings as c-format #1763
Conversation
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 cockpit-project/cockpit@449d76c0e6d9 Fixes cockpit-project#1712
From @allisonkarlitskaya : Check |
See also this wall of text: https://www.gnu.org/software/gettext/manual/html_node/xgettext-Invocation.html#index-_002d_002dflag_002c-xgettext-option |
@allisonkarlitskaya These don't work. Your first reference applies to comments in the code, but I'm not willing to do that. I suppose I already pulled my hair out over that six years ago, so I'd like to keep the current seddery. It has served us well enough. |
I tried to change --- /tmp/podman.pot 2024-06-24 14:40:19.848671108 +0200
+++ po/podman.pot 2024-06-24 14:40:37.571759516 +0200
@@ -74,7 +74,7 @@
msgstr[1] ""
#: src/Containers.jsx:379
-#, c-format
+#, javascript-format
msgid "$0% of $1 limit"
msgstr ""
@@ -143,12 +143,11 @@
msgstr ""
#: src/PruneUnusedContainersModal.jsx:96 src/ContainerRenameModal.jsx:97
-#: src/ImageRunModal.jsx:1175 src/ContainerCheckpointModal.jsx:50
-#: src/ForceRemoveModal.jsx:25 src/ContainerDeleteModal.jsx:34
-#: src/ContainerRestoreModal.jsx:53 src/ImageSearchModal.jsx:152
-#: src/ImageDeleteModal.jsx:98 src/ContainerCommitModal.jsx:157
-#: src/PodActions.jsx:52 src/PruneUnusedImagesModal.jsx:97
-#: src/PodCreateModal.jsx:213
+#: src/ContainerCheckpointModal.jsx:50 src/ForceRemoveModal.jsx:25
+#: src/ContainerDeleteModal.jsx:34 src/ContainerRestoreModal.jsx:53
+#: src/ImageSearchModal.jsx:152 src/ImageDeleteModal.jsx:98
+#: src/ContainerCommitModal.jsx:157 src/PodActions.jsx:52
+#: src/PruneUnusedImagesModal.jsx:97 src/PodCreateModal.jsx:213
msgid "Cancel"
msgstr ""
@@ -250,7 +249,7 @@
msgid "Containers"
msgstr ""
-#: src/ImageRunModal.jsx:1172 src/PodCreateModal.jsx:210
+#: src/PodCreateModal.jsx:210
msgid "Create"
msgstr ""
@@ -258,19 +257,10 @@
msgid "Create a new image based on the current state of the $0 container."
msgstr ""
-#: src/ImageRunModal.jsx:1169
-msgid "Create and run"
-msgstr ""
-
-#: src/Containers.jsx:773 src/ImageRunModal.jsx:1166 src/Images.jsx:400
-#: src/Images.jsx:409
+#: src/Containers.jsx:773 src/Images.jsx:400 src/Images.jsx:409
msgid "Create container"
msgstr ""
-#: src/ImageRunModal.jsx:1166
-msgid "Create container in $0"
-msgstr ""
-
#: src/Containers.jsx:856
msgid "Create container in pod"
msgstr ""
There's nothing particularly special about the ImageRunModal.jsx:1166 one: title={this.props.pod ? cockpit.format(_("Create container in $0"), this.props.pod.Name) : _("Create container")} Or the :1169 one:
So this isn't reliable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't like it, but trust you that it's the best way.
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 thec-format
tag with sed.Taken from cockpit-project/cockpit@449d76c0e6d9
Fixes #1712
Tested with
make po/podman.pot
. diff: