git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-gui-i18n: Make "Revert changes in these $n files" translatable.

From
Christian Stimming <stimming@tuhh.de>
Date
Jul 26, 2007, 08:47 UTC
Message-ID
<20070726104723.ugsfnbj1ogw8gg4k@webmail.tu-harburg.de>
Dear Harri, (responding to the commit in the mob branch)

thanks for discovering this message that was missed from translation. I'd like to use the opportunity to explain shortly the situation with plural form translations. You wrote:

+ # Split question between singular and plural cases, because + # such distinction is needed in some languages.

The issue with plural forms is even more complicated than that. In fact, the gettext library in C has the separate function ngettext() solely for the purpose of dealing with plural forms correctly; see http://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 Czech)

Unfortunately the msgcat package of Tcl is missing all support for a meaningful implementation of plural forms. (IMHO that's quite a shortcoming of msgcat and quite a big advantage of gettext, but there isn't an easy solution in sight. Whatever.) For that reason we have to refrain from using any plural-form-depending messages at all.

Enough of this discussion.

In this *particular* commit, the plural-form discussion misses the point with the message in question. In this particular message, if $n==1 (one single file to be reverted), the *file name* should be printed in the message. If $n > 1, the *number of files* should be printed in the message. The i18n error that had to be fixed is that the English message used to be built up from several parts, which is a no-no for translatable strings, and you have fixed that correctly.

Nevertheless the last [mc...] message in your commit doesn't end up that nicely for the translator. As you have the first sentence already in another language and translated separately, I would suggest to have the second sentence translated separately as well, and then appending these together in the actual message being shown. Like the patch below.

Thanks again for spotting this error.
Christian
diff --git a/lib/index.tcl b/lib/index.tcl
index 9080ac6..e1bda52 100644
--- a/lib/index.tcl
+++ b/lib/index.tcl
@@ -350,17 +350,15 @@ proc revert_helper {txt paths} {
                 unlock_index
                 return
         } elseif {$n == 1} {
-               set s "[short_path [lindex $pathList]]"
+               set query [mc "Revert changes in file %s?" [short_path  
[lindex $pathList]]]
         } else {
-               set s "these $n files"
+               set query [mc "Revert changes in these %i files?" $n]
         }

         set reply [tk_dialog \
                 .confirm_revert \
                 "[appname] ([reponame])" \
-               [mc "Revert changes in %s?
-
-Any unadded changes will be permanently lost by the revert." $s] \
+               "$query\n\n[mc "Any unadded changes will be  
permanently lost by the revert."]" \
                 question \
                 1 \
                 [mc "Do Nothing"] \
--
1.5.3.rc2.12.gbc280
Next: Christian Stimming
Message 1 of 3 in “Re: git-gui-i18n: Make "Revert changes in these $n files" translatable.”
  1. Christian StimmingJul 26, 2007
  2. Christian StimmingJul 26, 2007
  3. Christian StimmingJul 26, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.