Untranslated strings in static const structs
Environment/Versions
- GIMP version: 2.99.16, also present on GIMP_2_99_16-964-g0532e1b0
- Package: flatpak and built from source
- Operating System: Linux
Description of the bug
Ran into a corner case when trying to make the GUI as translatable as possible. Strings affected by this are located in static const structs and use the N_
gettext macro. They are extracted by gettext, but the translations are not used in the GUI.
Example from modules/color-selector-water.c:
static const GimpModuleInfo colorsel_water_info =
{
GIMP_MODULE_ABI_VERSION,
N_("Watercolor style color selector"),
"Raph Levien <raph@acm.org>, Sven Neumann <sven@gimp.org>",
"v0.4",
"released under the GPL",
"1998-2006"
};
Replacing the macro N_
with _
works in many other cases, but here that leads to a compiler error for not being constant, so some other solution is needed:
../libgimp/libgimp-intl.h:31:20: error: initializer element is not constant
31 | #define _(String) dgettext (GETTEXT_PACKAGE "-libgimp", String)
| ^~~~~~~~
../modules/color-selector-water.c:96:3: note: in expansion of macro ‘_’
96 | _("Watercolor style color selector"),
| ^
Affected files:
-
plug-ins/common/file-compressor.c: N_("gzip archive"), N_("bzip archive"), N_("xz archive")
-
plug-ins/common/file-gegl.c:
N_("OpenEXR image"), N_("Radiance RGBE") -
And the module descriptions that can be seen in
Edit -> Modules
... For example: modules/color-selector-water.c: N_("Watercolor style color selector")
None of these are translated in the 2.99.16 flatpak
File types were translated in stable 2.10.36 flatpak, but the module decriptions were untranslated in that version as well.
Reproduction
Is the bug reproducible? Always
Reproduction steps:
- Use a locale where strings mentioned above are translated
- Open
Edit -> Modules
, or try to export a file as an archive type - The module names or the file types mentioned above are untranslated
…
Expected result: Translated strings for all file types and module names
Actual result: Untranslated strings