[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] Proper plural localisation of conflict summary

From: Mattias Engdegård <mattiase_at_bredband.net>
Date: Sun, 14 Apr 2013 12:43:19 +0200

14 apr 2013 kl. 03.57 skrev Daniel Shahaf:

> We don't usually translate strings that don't contain
> alphanumerics. If
> you want to translate those, no opinion here either way, but you'll
> probably find a fair number of strings around the codebase to add _()
> around.

As you wish. I just noted this part of the gettext manual:

   For example, ‘"%s"’ is an example of string not requiring
translation. But ‘"%s: %d"’ does require translation, because in
French, unlike in English, it's customary to put a space before a colon.

Anyway, here is a reformulated version without localised non-verbal
strings.

[[[
Use correct grammatical number localisation for conflict summary
messages.

* subversion/svn/notify.c
   (resolved_str, remaining_str): New.
   (svn_cl__notifier_print_conflict_stats):
    Call resolved_str and remaining_str for number-aware
    localisation of messages.
]]]

Index: subversion/svn/notify.c
===================================================================
--- subversion/svn/notify.c (revision 1467712)
+++ subversion/svn/notify.c (working copy)
@@ -89,6 +89,24 @@
   return SVN_NO_ERROR;
 }
 
+static const char *
+remaining_str(apr_pool_t *pool, int n_remaining)
+{
+ return apr_psprintf(pool, Q_("%d remaining",
+ "%d remaining",
+ n_remaining),
+ n_remaining);
+}
+
+static const char *
+resolved_str(apr_pool_t *pool, int n_resolved)
+{
+ return apr_psprintf(pool, Q_("and %d already resolved",
+ "and %d already resolved",
+ n_resolved),
+ n_resolved);
+}
+
 svn_error_t *
 svn_cl__notifier_print_conflict_stats(void *baton, apr_pool_t *scratch_pool)
 {
@@ -126,16 +144,19 @@
     {
       if (n_text > 0 || n_text_r > 0)
         SVN_ERR(svn_cmdline_printf(scratch_pool,
- _(" Text conflicts: %d remaining (and %d already resolved)\n"),
- n_text, n_text_r));
+ _(" Text conflicts: %s (%s)\n"),
+ remaining_str(scratch_pool, n_text),
+ resolved_str(scratch_pool, n_text_r)));
       if (n_prop > 0 || n_prop_r > 0)
         SVN_ERR(svn_cmdline_printf(scratch_pool,
- _(" Property conflicts: %d remaining (and %d already resolved)\n"),
- n_prop, n_prop_r));
+ _(" Property conflicts: %s (%s)\n"),
+ remaining_str(scratch_pool, n_prop),
+ resolved_str(scratch_pool, n_prop_r)));
       if (n_tree > 0 || n_tree_r > 0)
         SVN_ERR(svn_cmdline_printf(scratch_pool,
- _(" Tree conflicts: %d remaining (and %d already resolved)\n"),
- n_tree, n_tree_r));
+ _(" Tree conflicts: %s (%s)\n"),
+ remaining_str(scratch_pool, n_tree),
+ resolved_str(scratch_pool, n_tree_r)));
     }
   if (nb->skipped_paths > 0)
     SVN_ERR(svn_cmdline_printf(scratch_pool,

Received on 2013-04-14 12:43:58 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.