GNOME Bugzilla – Bug 167126
Janitoring i18n strings
Last modified: 2009-08-15 18:40:50 UTC
Meld has 276 i18n strings. Some strings look like duplicate : #: ../glade2/filediff.glade.h:11 msgid "Save _As..." AND #: ../filediff.py:111 msgid "_Save As..." #: ../glade2/filediff.glade.h:6 msgid "Find" AND #: ../filediff.py:124 msgid "_Find" #: ../filediff.py:597 #, python-format msgid "" "Could not open '%s' for reading.\n" "\n" "The error was:\n" "%s" AND #: ../glade.py:360 #, python-format msgid "" "Could not open '%s'.\n" "%s" Some look a bit cryptic: #: ../filediff.py:267 msgid "INS,OVR" Some look useless: #: ../filediff.py:1334 ../findreplace.py:106 #, python-format msgid "%s" #: ../glade2/cvsview.glade.h:1 ../glade2/dirdiff.glade.h:1 #: ../glade2/meldapp.glade.h:3 msgid "*" #: ../glade2/cvsview.glade.h:2 msgid "..." #: ../glade2/meldapp.glade.h:93 msgid "utf8 iso8859" Some strings may be merged: #: ../meld:59 msgid "Meld requires a recent version of pygtk." AND #: ../meld:60 #, c-format msgid "pygtk-%s or higher is recommended." AND #: ../meld:70 #, c-format msgid "Meld requires pygtk-%s or higher. (found %s)" Some have strange spacing: #: ../glade2/meldapp.glade.h:60 msgid "Solid Filled Quadilaterals" #: ../glade2/meldapp.glade.h:1 msgid " spaces." (string surgery ?) Though I'm no i18n guru, i think Meld's strings need some love.
Full resolution will need some help from intltool or glade or both, for excessive markup items but many other items are fixable.
None of this seems related to bug #97061. I'm adding more buggy and confusing strings here: #: ../filediff.py:140 ../filediff.py:141 msgid "Copy selected text" Maybe one should be "Cut selected text" (same text is used for both "Cut" and "Copy" actions) #: ../filediff.py:295 msgid "Insert,Overwrite" Separate this out (code will even be cleaner if you just use [_("Insert"),_("Overwrite")][view.get_overwrite()], but be sure to also add comment for translators about what these are about #: ../meldapp.py:347 msgid "folder" #: ../meldapp.py:348 msgid "file" #: ../meldapp.py:349 msgid "nonexistant" String composition the way it's done in append_diff sucks. #: ../meldapp.py:482 msgid "Save snapshot to file,x,y,w,h" What's this "file,x,y,w,h" about at all? I suppose it's about versioning files in VC systems, but a comment explaining that to translators would be needed (and you'd probably need quotes around "file,x,y,w,h" if it's supposed to be treated as single filename). #: ../glade2/meldapp.glade.h:49 msgid "When loading, try these codecs in order. (e.g. utf8, iso8859)" #: ../glade2/meldapp.glade.h:62 msgid "utf8 iso8859" AFAIK, "iso8859" is not an encoding, it's a collection of encodings (iso8859-1, iso8859-2,...). A comment for translators would be appreciated to explain what should they translate this to (Glade supports such comments). I'll report another bug about technical strings which could probably be made less technical.
I've janitored the strings mentioned in Benoits original report. Danilo, whats a good way to give a meaningful error message like in append_diff without resorting to some kind of surgery? Re: codecs, the encodings are passed directly to python so I'd imagine iso8859 is a commonly used alias for iso8859-1. Is there a way to add comments to strings in glade files?
Changes. http://cvs.gnome.org/viewcvs/meld/filediff.py?rev=1.58.2.14&sortby=date&only_with_tag=branch-0_9&view=markup http://cvs.gnome.org/viewcvs/meld/meld?rev=1.18.2.3&sortby=date&only_with_tag=branch-0_9&view=markup http://cvs.gnome.org/viewcvs/meld/glade2/meldapp.glade?rev=1.21.2.8&sortby=date&only_with_tag=branch-0_9&view=markup
Created attachment 48123 [details] [review] ngettext love i reworked this bit of code to make proper use of gettext. untested (although import dirdiff does not raise any error) as i haven't gnomeprint. As gettext doesn't have N_ to mark string for translation, i had to use so lambda-fu :) I also s/div/n as div is a builtin function.
On Benoit's changes. Is there really a reason not to use full strings in ngettext calls instead (this is important for languages where this might turn out to be "seconds %s%i")? For example, times = ( # translators: %s is for sign ("-" or empty for positive number) (60, ngettext("%s%i second", "%s%i seconds", n)), (60, ngettext("%s%i minute", "%s%i minutes", n)), ... ) The same is true for append_diff: if you can't put it in one string (which it seems it can't be put, because you don't know the size of it beforehand), then what you want to do is to allow those building parts to be translated as well, and add a suitable comment explaining all this to translators, eg.: # translators: this is used as type in "(%s)\t`%s'" message _("folder")... _("file") ... _("nonexistant") # translators: first "%s" is for type ("file", "folder" or "nonexistant"), and second "%s" is for referring path extra.append( _("(%s)\t`%s'") % (what, paths[i]) ) Note that this is only a suggestion. You might also want to use Python %(variablename)s instead of simple %s to make it easier for translators to move them around.
Created attachment 48139 [details] [review] updated patch for dirdiff.py
I've committed a patch based on Benoit's for the ngettext. I've removed the dodgy append_diff string as it's not too importatnt and exeedingly rarely seen. AFAICS thats the last of the reported issues. There are a few more things I'd like to clean up (such as \n\t in strings) but they're very minor and can wait for the next release.
http://cvs.gnome.org/viewcvs/meld/dirdiff.py?r1=1.53.2.4&r2=1.53.2.5&only_with_tag=branch-0_9
Batch close of old bugs.