Comment on attachment 38166
Optionally use gettext for translations in .policy files

Review of attachment 38166:
-----------------------------------------------------------------

It might be useful to also allow gettext-domain to be specified on the
<policyconfig> element, to avoid repeating it on every single
<description> in the file.

::: src/polkitbackend/polkitbackendactionpool.c
@@ +1131,4 @@
>   * _localize:
>   * @translations: a mapping from xml:lang to the value, e.g. 'da' -> 
> 'Smadre', 'en_CA' -> 'Punch, Aye!'
>   * @untranslated: the untranslated value, e.g. 'Punch'
> + * @domain: the gettext domain for this string. Make be NULL.

s/Make/May/

@@ +1153,5 @@
> +    {
> +      gchar *old_locale;
> +
> +      old_locale = g_strdup (setlocale (LC_ALL, NULL));
> +      setlocale (LC_ALL, lang);

setlocale() is not thread safe. Since polkit could be being used from a
thread, we *cannot* call this.

We could use uselocale() instead, which only operates on the current
thread’s locale.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/uselocale.html

Unfortunately, as far as I know, there is no gettext function which
allows the locale to be specified. The other approach I can think of
would be to load up the gettext catalogues manually for the desired
locale, but I don’t know if APIs exist for that.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/619632

Title:
  Use gettext for translating user messages

To manage notifications about this bug go to:
https://bugs.launchpad.net/policykit-1/+bug/619632/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to