[geany/geany] 201ac6: Translate symbol tree roots
Jiří Techet
git-noreply at geany.org
Sun Apr 10 12:34:15 UTC 2022
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Sun, 10 Apr 2022 12:34:15 UTC
Commit: 201ac64545ea0d2857f55dcd7440b07a1672bbcb
https://github.com/geany/geany/commit/201ac64545ea0d2857f55dcd7440b07a1672bbcb
Log Message:
-----------
Translate symbol tree roots
Using _() macros from glib/gi18n-lib.h for translatable strings isn't
possible because we need to use them in global static initializers where
g_dgettext() (to which _() expands) cannot be called.
Still, we need to define _() and use it to mark translatable strings so
the command-line xgettext finds them. Then, we can call g_dgettext()
manually at the appropriate place to get the translated string.
Modified Paths:
--------------
po/POTFILES.in
src/tagmanager/tm_parser.c
Modified: po/POTFILES.in
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -40,6 +40,7 @@ src/ui_utils.c
src/utils.c
src/vte.c
src/win32.c
+src/tagmanager/tm_parser.c
plugins/classbuilder.c
plugins/htmlchars.c
plugins/export.c
Modified: src/tagmanager/tm_parser.c
8 lines changed, 8 insertions(+), 0 deletions(-)
===================================================================
@@ -23,7 +23,11 @@
#include <string.h>
+#include "config.h"
+
+/* Only for the command-line xgettext tool to find translatable strings.
+ * The gettext() function is invoked manually using glib g_dgettext() */
#define _(String) (String)
typedef struct
@@ -1073,7 +1077,11 @@ const gchar *tm_parser_get_sidebar_info(TMParserType lang, gint group, guint *ic
grp = &map->groups[group];
*icon = grp->icon;
+#ifdef GETTEXT_PACKAGE
+ return g_dgettext(GETTEXT_PACKAGE, grp->name);
+#else
return grp->name;
+#endif
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list