GNOME Bugzilla – Bug 744255
Disambiguate string "Add Tags"
Last modified: 2016-07-10 12:49:49 UTC
Please split this string because one is for dialog title and second case is for menu item. we have different translation for these cases. #: ../src/Resources.vala:290 ../src/Resources.vala:323 msgid "Add Tags" Dev wiki link: https://wiki.gnome.org/TranslationProject/DevGuidelines/Translation%20contexts
Are there any conventions on the contexts or would something like diff --git a/src/Resources.vala b/src/Resources.vala index 3b15d11..19f0ca4 100644 --- a/src/Resources.vala +++ b/src/Resources.vala @@ -320,7 +320,7 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc., public const string ADD_TAGS_MENU = _("Add _Tags..."); public const string ADD_TAGS_CONTEXT_MENU = _("_Add Tags..."); // Dialog title - public const string ADD_TAGS_TITLE = _("Add Tags"); + public const string ADD_TAGS_TITLE = C_("Dialog Title", "Add Tags"); public const string PREFERENCES_MENU = _("_Preferences"); @@ -353,7 +353,7 @@ along with Shotwell; if not, write to the Free Software Foundation, Inc., HierarchicalTagUtilities.get_basename(names[1])); } else { // Undo/Redo command name (in Edit menu) - return _("Add Tags"); + return C_("Edit Menu", "Add Tags"); } } do?
This doesn't seem to work. I patched this into the source code, ran 'make update-po' inside po/, and the msgid "Add Tags" desappeared from PO files, indicating that it was not found in the source code. Also, I tried to compile the source code with that patch and it failed with the following output: VALAC shotwell_vala.stamp src/Resources.vala:318.42-318.71: error: Value must be constant public const string ADD_TAGS_TITLE = C_("Dialog Title", "Add Tags"); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ src/Dialogs.vala:1977.15-1977.38: error: Invalid type for argument 1 base (Resources.ADD_TAGS_TITLE, _("Tags (separated by commas):")); ^^^^^^^^^^^^^^^^^^^^^^^^ Compilation failed: 2 error(s), 0 warning(s) make[2]: *** [Makefile:6707: shotwell_vala.stamp] Error 1 make[2]: Leaving directory '/build/shotwell-git/src/shotwell' make[1]: *** [Makefile:6997: all-recursive] Error 1 make[1]: Leaving directory '/build/shotwell-git/src/shotwell' make: *** [Makefile:1435: all] Error 2
Ah, sorry, I think didn't actually try the patch, this has to be NC_ of course. Then with make update-po, you get #: src/Resources.vala:318 #, fuzzy msgctxt "Dialog Title" msgid "Add Tags" msgstr "Stichworte hinzufügen"
Yep, adding NC_ do the job. I'm not the requester, but IMHO this patch solves the ambiguity.
yep. it looks fine now. thank you!
Created attachment 330808 [details] [review] i18n: Disambiguate string "Add Tags" Signed-off-by: Jens Georg <mail@jensge.org>
You probably need to update https://git.gnome.org/browse/shotwell/tree/po/Makevars#n11 as well.
Looking at the documentation, I suspect just dropping the --keyword things would be sufficient?
I'm not sure about that, other modules define keywords: https://git.gnome.org/browse/gnome-flashback/tree/po/Makevars#n11 https://git.gnome.org/browse/gtk+/tree/po/Makevars#n11
The xgettext info page says those are default for Vala: • For Vala: ‘_’, ‘Q_’, ‘N_’, ‘NC_’, ‘dgettext:2’, ‘dcgettext:2’, ‘ngettext:1,2’, ‘dngettext:2,3’, ‘dpgettext:2c,3’, ‘dpgettext2:2c,3’. So I just remove _ and N_ and it should be fine. Texts show up in pot
Attachment 330808 [details] pushed as 80eb795 - i18n: Disambiguate string "Add Tags"
It appears that two strings are not extracted properly: https://l10n.gnome.org/POT/shotwell.master/shotwell.master.pl.po - look at the end of the file: #~ msgctxt "Dialog Title" #~ msgid "Edit Title" #~ msgstr "Modyfikacja tytułu" #~ msgctxt "UndoRedo menu entry" #~ msgid "Add Tags" #~ msgstr "Dodaj etykiety"
Missing N from NC_
But the string is in normal code flow, not in array initializer
Ah, it's in comment 10 - C_ is not in the vala defaults.
Created attachment 331161 [details] [review] i18n: Add C_ to vala keywords Signed-off-by: Jens Georg <mail@jensge.org>
Attachment 331161 [details] pushed as 1eb0bda - i18n: Add C_ to vala keywords