On Sat, 2018-09-15 at 16:25 +0200, rastersoft wrote:
>     Hi all:
>     I'm doing an schema for gsettings. This is part of it:
>     <schemalist gettext-domain="desktop-icons">
>     <enum id="org.gnome.shell.extension.desktop-icons.ZoomLevel">
>         <value value="0" nick="small"/>
>         <value value="1" nick="standard"/>
>         <value value="2" nick="large"/>
>         <value value="3" nick="huge"/>
>     </enum>
>     <schema path="/org/gnome/shell/extensions/desktop-icons/"
> id="org.gnome.shell.extensions.desktop-icons" gettext-
> domain="desktop-icons">
>     <key name="icon-size" enum="org.gnome.shell.extension.desktop-
> icons.ZoomLevel">
>         <default>"large"</default>
>         <summary>Icon size</summary>
>         <description>Set the size for the desktop
> icons.</description>
>     </key>
>     After passing xgettext, it adds to the .po file all the "summary"
>       and "description" contents, but it doesn't add the nicks in the
>       enum (this is, the strings "small", "standard", "large" and
> "huge"
>       aren't added to the .pot file). But I want to show in my
> program
>       the values translated.
>     Of course, I now that in the settings itself I must use the
>       original strings, not the translated ones, but I don't want
>       gsettings_schema_key to return those values already translated;
> I
>       only want to ensure that xgettext adds those strings to the
> .pot
>       file.
> 
>       
> 
>       I tried adding l10n="messages" to each value, but the compiler
>       doesn't like it. I tried using "alias" inside the key part, but
>       they aren't added, and adding l10n to the aliases is also not
>       allowed.
> 
>     
>     So the question is: how can I do that?
>     

tl;dr: You can’t do that from a GSettings schema file. GLib doesn’t
support translations of enum/flag value names or nicknames, because
they can end up being used as identifiers for the enum/flag values (for
example, when calling g_enum_get_value_by_nick()).

Probably the right way to do it is to keep an array of the translatable
enum names in your code, and have xgettext extract the strings from
that. Presumably you’ll need the enum names in your code somewhere
anyway to put them in the UI.

If you really want to make everything dynamic, you could write some
custom ITS rules for extracting the enum nicks from the GSettings XML
file, and use them with xgettext’s `--its` argument.

Philip

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list

Reply via email to