Mageia Bugzilla – Attachment 5678 Details for
Bug 14636
LXDE Menu is translated less
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
New Account
|
Forgot Password
[patch]
Updated patch add support for translations from menu-messages pkg
menu-cache-1.0.0-mga-use-menu-messages.patch (text/plain), 2.17 KB, created by
Nicolas Salguero
on 2014-12-04 13:11:21 CET
(
hide
)
Description:
Updated patch add support for translations from menu-messages pkg
Filename:
MIME Type:
Creator:
Nicolas Salguero
Created:
2014-12-04 13:11:21 CET
Size:
2.17 KB
patch
obsolete
>--- menu-cache-1.0.0/menu-cache-gen/menu-compose.c.orig 2014-12-04 09:34:02.951335896 +0100 >+++ menu-cache-1.0.0/menu-cache-gen/menu-compose.c 2014-12-04 11:52:07.783239298 +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, *lc_messages; > > for (lang = languages; lang[0] != NULL; lang++) > { >@@ -108,8 +113,21 @@ > 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); >+ if ((str != NULL) && (str[0] != '\0')) >+ { >+ lc_messages = getenv("LC_MESSAGES"); >+ 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); >+ setenv("LC_MESSAGES", lc_messages, 1); >+ } >+ else >+ result = str; >+ return _escape_lf(result); > } > > static char **_get_string_list(GKeyFile *kf, const char *key, gsize *lp) >@@ -457,7 +475,7 @@ > g_list_free(menu->id); > _free_leftovers(menu->children); > _free_layout_items(menu->layout.items); >- g_free(menu->title); >+ /*g_free(menu->title);*/ > g_free(menu->comment); > g_free(menu->icon); > g_slice_free(MenuMenu, menu); >@@ -1089,7 +1107,7 @@ > /* Free all the data */ > menu_menu_free(layout); > g_free(tmp); >- g_hash_table_destroy(all_apps); >+ /*g_hash_table_destroy(all_apps);*/ > g_slist_free(DEs); > g_slist_free(loaded_dirs); > return ok;
--- menu-cache-1.0.0/menu-cache-gen/menu-compose.c.orig 2014-12-04 09:34:02.951335896 +0100 +++ menu-cache-1.0.0/menu-cache-gen/menu-compose.c 2014-12-04 11:52:07.783239298 +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, *lc_messages; for (lang = languages; lang[0] != NULL; lang++) { @@ -108,8 +113,21 @@ 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); + if ((str != NULL) && (str[0] != '\0')) + { + lc_messages = getenv("LC_MESSAGES"); + 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); + setenv("LC_MESSAGES", lc_messages, 1); + } + else + result = str; + return _escape_lf(result); } static char **_get_string_list(GKeyFile *kf, const char *key, gsize *lp) @@ -457,7 +475,7 @@ g_list_free(menu->id); _free_leftovers(menu->children); _free_layout_items(menu->layout.items); - g_free(menu->title); + /*g_free(menu->title);*/ g_free(menu->comment); g_free(menu->icon); g_slice_free(MenuMenu, menu); @@ -1089,7 +1107,7 @@ /* Free all the data */ menu_menu_free(layout); g_free(tmp); - g_hash_table_destroy(all_apps); + /*g_hash_table_destroy(all_apps);*/ g_slist_free(DEs); g_slist_free(loaded_dirs); return ok;
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 14636
:
5648
| 5678 |
5679