{"thread":{"id":"9240","subject":"Re: git-gui-i18n: Make \"Revert changes in these $n files\" translatable.","startedAt":"2007-07-26T08:47:23Z","lastAt":"2007-07-26T14:53:34Z","messageCount":3,"participants":["Christian Stimming"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"48680","messageId":"20070726104723.ugsfnbj1ogw8gg4k@webmail.tu-harburg.de","threadId":"9240","inReplyTo":null,"subject":"Re: git-gui-i18n: Make \"Revert changes in these $n files\" translatable.","fromName":"Christian Stimming","fromEmail":"stimming@tuhh.de","sentAt":"2007-07-26T08:47:23Z","receivedAt":"2007-07-26T08:47:23Z","isPatch":false,"sender":{"key":"stimming@tuhh.de","avatar":"https://avatars.githubusercontent.com/u/227778?v=4"},"body":"Dear Harri, (responding to the commit in the mob branch)\n\nthanks for discovering this message that was missed from translation.  \nI'd like to use the opportunity to explain shortly the situation with  \nplural form translations. You wrote:\n\n+\t# Split question between singular and plural cases, because\n+\t# such distinction is needed in some languages.\n\nThe issue with plural forms is even more complicated than that. In  \nfact, the gettext library in C has the separate function ngettext()  \nsolely for the purpose of dealing with plural forms correctly; see  \nhttp://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html#Plural-forms for the (lengthy but interesting) explanation. All one has to know is this: There are many languages out there that have not only one singular and one plural form, but much more of them, depending on the actual number of items being talked about. (Example: Three forms, with special cases for 1 and 2, 3, 4, in Slovak and  \nCzech)\n\nUnfortunately the msgcat package of Tcl is missing all support for a  \nmeaningful implementation of plural forms. (IMHO that's quite a  \nshortcoming of msgcat and quite a big advantage of gettext, but there  \nisn't an easy solution in sight. Whatever.) For that reason we have to  \nrefrain from using any plural-form-depending messages at all.\n\nEnough of this discussion.\n\nIn this *particular* commit, the plural-form discussion misses the  \npoint with the message in question. In this particular message, if  \n$n==1 (one single file to be reverted), the *file name* should be  \nprinted in the message. If $n > 1, the *number of files* should be  \nprinted in the message. The i18n error that had to be fixed is that  \nthe English message used to be built up from several parts, which is a  \nno-no for translatable strings, and you have fixed that correctly.\n\nNevertheless the last [mc...] message in your commit doesn't end up  \nthat nicely for the translator. As you have the first sentence already  \nin another language and translated separately, I would suggest to have  \nthe second sentence translated separately as well, and then appending  \nthese together in the actual message being shown. Like the patch below.\n\nThanks again for spotting this error.\n\nChristian\n\n\ndiff --git a/lib/index.tcl b/lib/index.tcl\nindex 9080ac6..e1bda52 100644\n--- a/lib/index.tcl\n+++ b/lib/index.tcl\n@@ -350,17 +350,15 @@ proc revert_helper {txt paths} {\n                 unlock_index\n                 return\n         } elseif {$n == 1} {\n-               set s \"[short_path [lindex $pathList]]\"\n+               set query [mc \"Revert changes in file %s?\" [short_path  \n[lindex $pathList]]]\n         } else {\n-               set s \"these $n files\"\n+               set query [mc \"Revert changes in these %i files?\" $n]\n         }\n\n         set reply [tk_dialog \\\n                 .confirm_revert \\\n                 \"[appname] ([reponame])\" \\\n-               [mc \"Revert changes in %s?\n-\n-Any unadded changes will be permanently lost by the revert.\" $s] \\\n+               \"$query\\n\\n[mc \"Any unadded changes will be  \npermanently lost by the revert.\"]\" \\\n                 question \\\n                 1 \\\n                 [mc \"Do Nothing\"] \\\n--\n1.5.3.rc2.12.gbc280\n"},{"id":"48696","messageId":"20070726143449.iklqfh5c6c48844k@webmail.tu-harburg.de","threadId":"9240","inReplyTo":"20070726115301.GA27821@cc.hut.fi","subject":"Re: git-gui-i18n: Make \"Revert changes in these $n files\" translatable.","fromName":"Christian Stimming","fromEmail":"stimming@tuhh.de","sentAt":"2007-07-26T12:34:49Z","receivedAt":"2007-07-26T12:34:49Z","isPatch":false,"sender":{"key":"stimming@tuhh.de","avatar":"https://avatars.githubusercontent.com/u/227778?v=4"},"body":"Quoting Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi>:\n> On Thu, Jul 26, 2007 at 10:47:23AM +0200, Christian Stimming wrote:\n>> The issue with plural forms is even more complicated than that.\n>\n> Yes, I know that some languages have very complex plural forms. I even\n> tought about that, but forgot to tack in FIXME comment. :-(\n\nOk. Thanks for adding the explanation.\n\n> One can do bit nasty workarounds for the msgcat's inability to do\n> proper plural form translation.\n\nI don't think any workarounds for the plural forms would bring us very  \nfar. For now, I think it is just fine to state there is no plural form  \nsupport in msgcat, so we can't use it. (That being said, I think the  \napproach taken by gettext is by far the best one: Let the translator  \ndefine the available plural forms inside the po file header by  \n\"Plural-Forms:\". One would have to transfer this information over to  \ntcl and add the necessary instrumentation into msgcat to process this  \nexpression. Maybe some day, some time.)\n\n> BTW: Here is list of some missed translations:\n>\n> - Git version query when it can't grok the version (the yes/no one).\n> - 3 Menu entries in \"Repository\" menu (\"Browse branch files\", \"Browse\n>   foo's files\", \"Visualize foo's history\".\n\nThanks for all of them. I think now I caught them all. See patch  \nbelow, which I'll push but not before the weekend (due to firewall  \nrestrictions).\n\n> - Font setting names in options window.\n\nYou mean the names of the fonts? But those are names. I thought by  \ndefinition they cannot be translated.\n\n> - \"Starting revision\" in branch create window.\n> - \"Revision\" in branch checkout window.\n\nThanks, fixed.\n\n> - Buttons in hard reset confirmation (branch->revert or merge->abort,\n>   and it is yes/no dialog).\n\nI see this in translated form (German Ja/Nein), and also the button  \ntext (translated or not) doesn't appear in the git-gui source code.  \nMaybe those need to be translated in the tcl/tk system libraries?\n\n> - \"Fetch from foo\" entries in fetch menu.\n\nDone. Thanks a lot.\n\n---\n  git-gui.sh              |   16 ++++++++--------\n  lib/branch_checkout.tcl |    2 +-\n  lib/branch_create.tcl   |    2 +-\n  lib/browser.tcl         |    2 +-\n  lib/checkout_op.tcl     |    2 +-\n  lib/option.tcl          |    3 +--\n  lib/remote.tcl          |    2 +-\n  7 files changed, 14 insertions(+), 15 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 3536d38..9f903ba 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -564,14 +564,14 @@ if {![regexp {^[1-9]+(\\.[0-9]+)+$} $_git_version]} {\n  \t\t-type yesno \\\n  \t\t-default no \\\n  \t\t-title \"[appname]: warning\" \\\n-\t\t-message \"Git version cannot be determined.\n+\t\t -message [mc \"Git version cannot be determined.\n\n-$_git claims it is version '$_real_git_version'.\n+%s claims it is version '%s'.\n\n-[appname] requires at least Git 1.5.0 or later.\n+%s requires at least Git 1.5.0 or later.\n\n-Assume '$_real_git_version' is version 1.5.0?\n-\"] eq {yes}} {\n+Assume '%s' is version 1.5.0?\n+\" $_git $_real_git_version [appname] $_real_git_version]] eq {yes}} {\n  \t\tset _git_version 1.5.0\n  \t} else {\n  \t\texit 1\n@@ -1689,16 +1689,16 @@ menu .mbar.repository\n  .mbar.repository add command \\\n  \t-label [mc \"Browse Current Branch's Files\"] \\\n  \t-command {browser::new $current_branch}\n-trace add variable current_branch write \".mbar.repository entryconf  \n[.mbar.repository index last] -label \\\"Browse \\$current_branch's  \nFiles\\\" ;#\"\n+trace add variable current_branch write \".mbar.repository entryconf  \n[.mbar.repository index last] -label \\[format \\\"[mc \"Browse %s's  \nFiles\"]\\\" \\$current_branch\\] ;#\"\n  .mbar.repository add command \\\n-\t-label {Browse Branch Files...} \\\n+\t-label [mc \"Browse Branch Files...\"] \\\n  \t-command browser_open::dialog\n  .mbar.repository add separator\n\n  .mbar.repository add command \\\n  \t-label [mc \"Visualize Current Branch's History\"] \\\n  \t-command {do_gitk $current_branch}\n-trace add variable current_branch write \".mbar.repository entryconf  \n[.mbar.repository index last] -label \\\"Visualize \\$current_branch's  \nHistory\\\" ;#\"\n+trace add variable current_branch write \".mbar.repository entryconf  \n[.mbar.repository index last] -label \\[format \\\"[mc \"Visualize %s's  \nHistory\"]\\\" \\$current_branch\\] ;#\"\n  .mbar.repository add command \\\n  \t-label [mc \"Visualize All Branch History\"] \\\n  \t-command {do_gitk --all}\ndiff --git a/lib/branch_checkout.tcl b/lib/branch_checkout.tcl\nindex c727437..7d71821 100644\n--- a/lib/branch_checkout.tcl\n+++ b/lib/branch_checkout.tcl\n@@ -29,7 +29,7 @@ constructor dialog {} {\n  \tpack $w.buttons.cancel -side right -padx 5\n  \tpack $w.buttons -side bottom -fill x -pady 10 -padx 10\n\n-\tset w_rev [::choose_rev::new $w.rev {Revision}]\n+\tset w_rev [::choose_rev::new $w.rev [mc Revision]]\n  \t$w_rev bind_listbox <Double-Button-1> [cb _checkout]\n  \tpack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5\n\ndiff --git a/lib/branch_create.tcl b/lib/branch_create.tcl\nindex acfe411..53dfb4c 100644\n--- a/lib/branch_create.tcl\n+++ b/lib/branch_create.tcl\n@@ -63,7 +63,7 @@ constructor dialog {} {\n  \tgrid columnconfigure $w.desc 1 -weight 1\n  \tpack $w.desc -anchor nw -fill x -pady 5 -padx 5\n\n-\tset w_rev [::choose_rev::new $w.rev {Starting Revision}]\n+\tset w_rev [::choose_rev::new $w.rev [mc \"Starting Revision\"]]\n  \tpack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5\n\n  \tlabelframe $w.options -text [mc Options]\ndiff --git a/lib/browser.tcl b/lib/browser.tcl\nindex 9435e67..f9cfc6a 100644\n--- a/lib/browser.tcl\n+++ b/lib/browser.tcl\n@@ -271,7 +271,7 @@ constructor dialog {} {\n  \tpack $w.buttons.cancel -side right -padx 5\n  \tpack $w.buttons -side bottom -fill x -pady 10 -padx 10\n\n-\tset w_rev [::choose_rev::new $w.rev {Revision}]\n+\tset w_rev [::choose_rev::new $w.rev [mc Revision]]\n  \t$w_rev bind_listbox <Double-Button-1> [cb _open]\n  \tpack $w.rev -anchor nw -fill both -expand 1 -pady 5 -padx 5\n\ndiff --git a/lib/checkout_op.tcl b/lib/checkout_op.tcl\nindex 25bf9cf..d2fbc30 100644\n--- a/lib/checkout_op.tcl\n+++ b/lib/checkout_op.tcl\n@@ -76,7 +76,7 @@ method run {} {\n  \t\t_toplevel $this {Refreshing Tracking Branch}\n  \t\tset w_cons [::console::embed \\\n  \t\t\t$w.console \\\n-\t\t\t\"Fetching $r_name from $remote\"]\n+\t\t\t[mc \"Fetching %s from %s\" $r_name $remote]]\n  \t\tpack $w.console -fill both -expand 1\n  \t\t$w_cons exec $cmd [cb _finish_fetch]\n\ndiff --git a/lib/option.tcl b/lib/option.tcl\nindex 8d9e09d..20f1e8e 100644\n--- a/lib/option.tcl\n+++ b/lib/option.tcl\n@@ -74,8 +74,7 @@ proc do_about {} {\n  \tpack $w.buttons -side bottom -fill x -pady 10 -padx 10\n\n  \tlabel $w.desc \\\n-\t\t-text [append [mc \"git-gui - a graphical user interface for Git.\"] \"\n-$copyright\"] \\\n+\t\t-text \"[mc \"git-gui - a graphical user interface for Git.\"]\\n$copyright\" \\\n  \t\t-padx 5 -pady 5 \\\n  \t\t-justify left \\\n  \t\t-anchor w \\\ndiff --git a/lib/remote.tcl b/lib/remote.tcl\nindex c47ae50..71c7a0d 100644\n--- a/lib/remote.tcl\n+++ b/lib/remote.tcl\n@@ -153,7 +153,7 @@ proc populate_fetch_menu {} {\n  \t\tif {$enable} {\n  \t\t\tlappend prune_list $r\n  \t\t\t$m add command \\\n-\t\t\t\t-label \"Fetch from $r...\" \\\n+\t\t\t\t-label [mc \"Fetch from %s...\" $r] \\\n  \t\t\t\t-command [list fetch_from $r]\n  \t\t}\n  \t}\n-- \n1.5.3.rc2.12.gbc280\n"},{"id":"48709","messageId":"20070726165334.72vekk2ry80kk40c@webmail.tu-harburg.de","threadId":"9240","inReplyTo":"20070726142152.GA5335@cc.hut.fi","subject":"Re: git-gui-i18n: Make \"Revert changes in these $n files\" translatable.","fromName":"Christian Stimming","fromEmail":"stimming@tuhh.de","sentAt":"2007-07-26T14:53:34Z","receivedAt":"2007-07-26T14:53:34Z","isPatch":false,"sender":{"key":"stimming@tuhh.de","avatar":"https://avatars.githubusercontent.com/u/227778?v=4"},"body":"Quoting Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi>:\n>> >BTW: Here is list of some missed translations:\n>>\n>> >- Font setting names in options window.\n>>\n>> You mean the names of the fonts? But those are names. I thought by\n>> definition they cannot be translated.\n>\n> Nope. The texts are \"Main Font:\" and \"Diff/Console Font:\". They are\n> specified in somewhat bizarre manner (Search for \"Main Font\") from\n> git-gui.sh.\n\nOk, thanks for the pointer. Patch attached (will be push on the weekend).\n\n>> >- Buttons in hard reset confirmation (branch->revert or merge->abort,\n>> >  and it is yes/no dialog).\n>>\n>> I see this in translated form (German Ja/Nein), and also the button\n>> text (translated or not) doesn't appear in the git-gui source code.\n>> Maybe those need to be translated in the tcl/tk system libraries?\n>\n> I think that they might come from system libraries. But I'd rather\n> use better labels. AFAIK, HCI guidelines say that yes/no dialogs\n> are to be avoided, especally for confirming potentially destructive\n> actions.\n\nTrue for now. This would concern basically all question dialogs that  \nappear in git-gui.\n\nChristian\n\n\n---\n  git-gui.sh     |    4 ++--\n  lib/option.tcl |    2 +-\n  2 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/git-gui.sh b/git-gui.sh\nindex 9f903ba..463ec32 100755\n--- a/git-gui.sh\n+++ b/git-gui.sh\n@@ -1652,8 +1652,8 @@ set default_config(gui.newbranchtemplate) {}\n  set default_config(gui.fontui) [font configure font_ui]\n  set default_config(gui.fontdiff) [font configure font_diff]\n  set font_descs {\n-\t{fontui   font_ui   {Main Font}}\n-\t{fontdiff font_diff {Diff/Console Font}}\n+\t{fontui   font_ui   {mc \"Main Font\"}}\n+\t{fontdiff font_diff {mc \"Diff/Console Font\"}}\n  }\n  load_config 0\n  apply_config\ndiff --git a/lib/option.tcl b/lib/option.tcl\nindex 20f1e8e..31c7d47 100644\n--- a/lib/option.tcl\n+++ b/lib/option.tcl\n@@ -245,7 +245,7 @@ proc do_options {} {\n  \tforeach option $font_descs {\n  \t\tset name [lindex $option 0]\n  \t\tset font [lindex $option 1]\n-\t\tset text [lindex $option 2]\n+\t\tset text [eval [lindex $option 2]]\n\n  \t\tset global_config_new(gui.$font^^family) \\\n  \t\t\t[font configure $font -family]\n-- \n1.5.3.rc2.12.gbc280\n"}]}