Mageia Bugzilla – Attachment 5648 Details for
Bug 14636
LXDE Menu is translated less
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
Patch add support for translations from menu-messages pkg
menu-cache-1.0.0-mga-use-menu-messages.patch (text/plain), 1.44 KB, created by
Nicolas Salguero
on 2014-11-27 10:33:57 CET
(
hide
)
Description:
Patch add support for translations from menu-messages pkg
Filename:
MIME Type:
Creator:
Nicolas Salguero
Created:
2014-11-27 10:33:57 CET
Size:
1.44 KB
patch
obsolete
>--- menu-cache-1.0.0/menu-cache-gen/menu-compose.c.orig 2014-09-28 18:00:07.000000000 +0200 >+++ menu-cache-1.0.0/menu-cache-gen/menu-compose.c 2014-11-27 10:08:15.193574096 +0100 >@@ -32,6 +32,9 @@ > #include <stdio.h> > #include <glib/gstdio.h> > >+#include <stdlib.h> >+#include <libintl.h> >+ > #define NONULL(a) (a == NULL) ? "" : a > > static GSList *DEs = NULL; >@@ -94,11 +97,13 @@ > return _escape_lf(g_key_file_get_string(kf, G_KEY_FILE_DESKTOP_GROUP, key, NULL)); > } > >+#define MGA_GETTEXT_PACKAGE "menu-messages" >+ > /* g_key_file_get_locale_string is too much limited so implement replacement */ > static char *_get_language_string(GKeyFile *kf, const char *key) > { > char **lang; >- char *try_key, *str; >+ char *try_key, *str, *result; > > for (lang = languages; lang[0] != NULL; lang++) > { >@@ -108,8 +113,14 @@ > if (str != NULL) > return str; > } >- return _escape_lf(g_key_file_get_locale_string(kf, G_KEY_FILE_DESKTOP_GROUP, >- key, languages[0], NULL)); >+ str = g_key_file_get_locale_string(kf, G_KEY_FILE_DESKTOP_GROUP, key, languages[0], NULL); >+ setenv("LC_MESSAGES", languages[0], 1); >+ textdomain(MGA_GETTEXT_PACKAGE); >+ bind_textdomain_codeset(MGA_GETTEXT_PACKAGE, "utf-8"); >+ result = gettext(str); >+ if (result != str) >+ g_free(str); >+ return _escape_lf(result); > } > > static char **_get_string_list(GKeyFile *kf, const char *key, gsize *lp)
--- menu-cache-1.0.0/menu-cache-gen/menu-compose.c.orig 2014-09-28 18:00:07.000000000 +0200 +++ menu-cache-1.0.0/menu-cache-gen/menu-compose.c 2014-11-27 10:08:15.193574096 +0100 @@ -32,6 +32,9 @@ #include <stdio.h> #include <glib/gstdio.h> +#include <stdlib.h> +#include <libintl.h> + #define NONULL(a) (a == NULL) ? "" : a static GSList *DEs = NULL; @@ -94,11 +97,13 @@ return _escape_lf(g_key_file_get_string(kf, G_KEY_FILE_DESKTOP_GROUP, key, NULL)); } +#define MGA_GETTEXT_PACKAGE "menu-messages" + /* g_key_file_get_locale_string is too much limited so implement replacement */ static char *_get_language_string(GKeyFile *kf, const char *key) { char **lang; - char *try_key, *str; + char *try_key, *str, *result; for (lang = languages; lang[0] != NULL; lang++) { @@ -108,8 +113,14 @@ if (str != NULL) return str; } - return _escape_lf(g_key_file_get_locale_string(kf, G_KEY_FILE_DESKTOP_GROUP, - key, languages[0], NULL)); + str = g_key_file_get_locale_string(kf, G_KEY_FILE_DESKTOP_GROUP, key, languages[0], NULL); + setenv("LC_MESSAGES", languages[0], 1); + textdomain(MGA_GETTEXT_PACKAGE); + bind_textdomain_codeset(MGA_GETTEXT_PACKAGE, "utf-8"); + result = gettext(str); + if (result != str) + g_free(str); + return _escape_lf(result); } static char **_get_string_list(GKeyFile *kf, const char *key, gsize *lp)
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 14636
:
5648
|
5678
|
5679