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

From: Christian Stimming <hidden>
Date: 2016-06-15 22:43:24
Subsystem: library code, the rest · Maintainers: Andrew Morton, Linus Torvalds

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help