After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 549489 - Context needed on Logout string
Context needed on Logout string
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Sound
git master
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-08-26 19:26 UTC by Claude Paroz
Modified: 2008-08-28 20:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch to add context (1.16 KB, patch)
2008-08-26 19:28 UTC, Claude Paroz
reviewed Details | Review
Updated patch (5.89 KB, patch)
2008-08-27 19:27 UTC, Claude Paroz
reviewed Details | Review
Coding standard and glib 2.17.4 requirement (7.24 KB, patch)
2008-08-28 19:17 UTC, Claude Paroz
committed Details | Review

Description Claude Paroz 2008-08-26 19:26:58 UTC
The "logout string is now used in two different contexts:
#: ../capplets/sound/sound-theme-definition.h:58
#: ../libslab/bookmark-agent.c:1060
msgid "Logout"
msgstr ""

In libslab, this is a button label (translated by a verb in French) while in sound capplet is is an event (translated by a noun in French).
Therefore, we need to add translation context.
Comment 1 Claude Paroz 2008-08-26 19:28:57 UTC
Created attachment 117419 [details] [review]
Proposed patch to add context
Comment 2 Jens Granseuer 2008-08-27 16:40:15 UTC
The glib docs seem to suggest that when using NC_ you need to use a different gettext function to extract the string than if you were using N_. So, doesn't this break? Shouldn't we use Q_("Sound event|Logout") instead?
Comment 3 Claude Paroz 2008-08-27 18:50:53 UTC
I thought we were in the case where Q_ or C_ couldn't be used directly (string initialization). If it's not the case, then you can use C_ (Q_ will soon be deprecated in GNOME, see http://live.gnome.org/GnomeGoals/MsgctxtMigration).

But you're right in that NC_ should correspond to a g_dpgettext2 call at runtime. Moreover, I doubt it's possible to mix N_ and NC_ in the same array, as it will probably lead to problem at runtime where you have to choose either _( or g_dpgetext2.

Anyway, I'm not expert in C programming. It might be worth to ping mclasen who added recently NC_ in glib.
Comment 4 Matthias Clasen 2008-08-27 19:02:03 UTC
Claude is right

a) using Q_() in array initialization won't work, since it expands to a function call, and the compiler will complain.

b) mixing NC_() and N_() in the same array will make it impossible for you to get the translated string later

Jens is right that using NC_() means you need to slightly update the rule for generating  your pot in po/Makefile.in.in for xgettext to do the right thing with NC_(). See the NC_ docs for details.
Comment 5 Claude Paroz 2008-08-27 19:27:40 UTC
Created attachment 117477 [details] [review]
Updated patch

With latest intltool, the msgctxt are automatically added to the pot file.
Comment 6 Jens Granseuer 2008-08-28 16:51:02 UTC
Please use

g_dpgettext2 (...)

instead of

g_dpgettext2(...)

We also need to raise the glib requirement (to 2.17.4 I believe) if we start using NC_.

Otherwise looks ok.
Comment 7 Claude Paroz 2008-08-28 19:17:34 UTC
Created attachment 117544 [details] [review]
Coding standard and glib 2.17.4 requirement
Comment 8 Claude Paroz 2008-08-28 20:55:35 UTC
Will also write to gnome-i18n.