Project

General

Profile

action #13730 ยป 0001-Use-gettext-to-get-potential-distro-translations.diff

patch - lnussel, 2017-01-18 18:27

View differences:

src/polkitbackend/polkitbackendactionpool.c
#include <pwd.h>
#include <string.h>
#include <expat.h>
#include <locale.h>
#include <polkit/polkit.h>
#include <polkit/polkitprivate.h>
......
if (result != NULL)
goto out;
/* fall back to untranslated */
result = untranslated;
/* try distro provided language bundle via gettext */
/* Set LANG and locale so g_dgettext() + friends work below */
if (setlocale (LC_ALL, lang) == NULL)
{
g_printerr ("Invalid locale '%s'\n", lang);
}
g_setenv ("LANG", lang, TRUE);
result = g_dgettext ("polkit-distro-action-translations", untranslated);
/* Back to C! */
setlocale (LC_ALL, "C");
g_setenv ("LANG", "C", TRUE);
out:
return result;
    (1-1/1)