[Spice-devel] [PATCH spice-gtk] gettext: fix ngettext usage

Jakub Janku jjanku at redhat.com
Wed Apr 17 15:39:38 UTC 2019


On Wed, Apr 17, 2019 at 5:25 PM Frediano Ziglio <fziglio at redhat.com> wrote:
>
> >
> > _() should not be used in conjunction with ngettext(),
> > otherwise it's impossible to properly translate the message into
> > languages that have multiple plural forms, such as Czech.
> >
> > Fix ngettext usage in usb-device-widget.c and
> > update the PO files accordingly.
> >
> > Signed-off-by: Jakub Janků <jjanku at redhat.com>
>
> Sounds good, I'll have a small try before.
>
> Can you review David Jaša patch sent on Apr 12th?

Sure, I've already started looking at it, that's how I discovered this issue.

Cheers,
Jakub
>
> > ---
> >  po/de.po                |  9 +++------
> >  po/fr.po                | 11 ++++-------
> >  po/it.po                | 12 +++++-------
> >  src/usb-device-widget.c |  4 ++--
> >  4 files changed, 14 insertions(+), 22 deletions(-)
> >
> > diff --git a/po/de.po b/po/de.po
> > index eb24de7..3ae6ae0 100644
> > --- a/po/de.po
> > +++ b/po/de.po
> > @@ -288,12 +288,9 @@ msgstr "Auswahl des USB-Geräts zum Weiterleiten"
> >  #: src/usb-device-widget.c:393
> >  #, c-format
> >  msgid "Select USB devices to redirect (%d free channel)"
> > -msgstr "Auswahl des USB-Geräts zum Weiterleiten (%d freier Kanal)"
> > -
> > -#: src/usb-device-widget.c:394
> > -#, c-format
> > -msgid "Select USB devices to redirect (%d free channels)"
> > -msgstr "Auswahl des USB-Geräts zum Weiterleiten (%d freie Kanäle)"
> > +msgid_plural "Select USB devices to redirect (%d free channels)"
> > +msgstr[0] "Auswahl des USB-Geräts zum Weiterleiten (%d freier Kanal)"
> > +msgstr[1] "Auswahl des USB-Geräts zum Weiterleiten (%d freie Kanäle)"
> >
> >  #: src/usb-device-widget.c:411
> >  msgid "Redirecting USB Device..."
> > diff --git a/po/fr.po b/po/fr.po
> > index e2dd3ad..6120ee0 100644
> > --- a/po/fr.po
> > +++ b/po/fr.po
> > @@ -271,15 +271,12 @@ msgstr ""
> >  msgid "Select USB devices to redirect"
> >  msgstr ""
> >
> > -#: src/usb-device-widget.c:420
> > +#: src/usb-device-widget.c:393
> >  #, c-format
> >  msgid "Select USB devices to redirect (%d free channel)"
> > -msgstr ""
> > -
> > -#: src/usb-device-widget.c:421
> > -#, c-format
> > -msgid "Select USB devices to redirect (%d free channels)"
> > -msgstr ""
> > +msgid_plural "Select USB devices to redirect (%d free channels)"
> > +msgstr[0] ""
> > +msgstr[1] ""
> >
> >  #: src/usb-device-widget.c:439
> >  msgid "Redirecting USB Device..."
> > diff --git a/po/it.po b/po/it.po
> > index a4e40e9..b7899a8 100644
> > --- a/po/it.po
> > +++ b/po/it.po
> > @@ -16,6 +16,7 @@ msgstr ""
> >  "MIME-Version: 1.0\n"
> >  "Content-Type: text/plain; charset=UTF-8\n"
> >  "Content-Transfer-Encoding: 8bit\n"
> > +"Plural-Forms: nplurals=2; plural=n != 1;\n"
> >  "X-Generator: Poedit 1.8.8\n"
> >
> >  #: src/channel-main.c:1868
> > @@ -286,15 +287,12 @@ msgstr "%s %s %s a %d-%d"
> >  msgid "Select USB devices to redirect"
> >  msgstr "Selezionare dispositivo USB da redirigere"
> >
> > -#: src/usb-device-widget.c:420
> > +#: src/usb-device-widget.c:393
> >  #, c-format
> >  msgid "Select USB devices to redirect (%d free channel)"
> > -msgstr "Selezionare dispositivo USB da redirigere (%d canale libero)"
> > -
> > -#: src/usb-device-widget.c:421
> > -#, c-format
> > -msgid "Select USB devices to redirect (%d free channels)"
> > -msgstr "Selezionare dispositivo USB da redirigere (%d canali liberi)"
> > +msgid_plural "Select USB devices to redirect (%d free channels)"
> > +msgstr[0] "Selezionare dispositivo USB da redirigere (%d canale libero)"
> > +msgstr[1] "Selezionare dispositivo USB da redirigere (%d canali liberi)"
> >
> >  #: src/usb-device-widget.c:439
> >  msgid "Redirecting USB Device..."
> > diff --git a/src/usb-device-widget.c b/src/usb-device-widget.c
> > index de62564..7979a2c 100644
> > --- a/src/usb-device-widget.c
> > +++ b/src/usb-device-widget.c
> > @@ -390,8 +390,8 @@ static gboolean
> > spice_usb_device_widget_update_status(gpointer user_data)
> >      redirecting = spice_usb_device_manager_is_redirecting(priv->manager);
> >
> >      g_object_get(priv->manager, "free-channels", &free_channels, NULL);
> > -    free_channels_str = ngettext(_("Select USB devices to redirect (%d free
> > channel)"),
> > -                                 _("Select USB devices to redirect (%d free
> > channels)"),
> > +    free_channels_str = ngettext("Select USB devices to redirect (%d free
> > channel)",
> > +                                 "Select USB devices to redirect (%d free
> > channels)",
> >                                   free_channels);
> >      str = g_strdup_printf(free_channels_str, free_channels);
> >      markup_str = g_strdup_printf("<b>%s</b>", str);
>
> Frediano


More information about the Spice-devel mailing list