Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCH 3/5] gettext docs: the gettext.h C interface

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:49:32

On Fri, Sep 10, 2010 at 23:06, Junio C Hamano [off-list ref] wrote:
Junio C Hamano [off-list ref] writes:
quoted
Ævar Arnfjörð Bjarmason  [off-list ref] writes:
...
quoted
+        static const char *reset_type_names[] = {
+            N_("mixed"), N_("soft"), N_("hard"), N_("merge"), N_("keep"), NULL
+        };
+
+    And then, later:
+
+        die(_("%s reset is not allowed in a bare repository"),
+               _(reset_type_names[reset_type]));
I do not think this is a very good example.  Unless we are doing l10n of
option names, a Portuguese won't be typing "git reset --misto", so there
is no point in invoking _(reset_type_names[]) to begin with, and there is
no need to mark mixed/soft/hard/... for translation.
Ahh, I think I should take half of what I said back.  The line of thought
here is that

 (1) the user types "git reset --mixed"; no l10n of option names;

 (2) however, various modes of operations in "reset" command have
    human-readable names, not necessarily cuttable-and-pastable for
    machine consumption.  E.g. "git reset --mixed" is called "mixed
    reset" in English and that is primarily meant to be explanation of
    concept in human language, i.e. should be translated.

Under that assumption, localizing reset_type_names[] in the above may make
sense.
Yeah.
I said "half of", because I think the example is still problematic if you
want to translate to a language where "reset" in the fixed part of the
die() message may need to be spelled differently depending on what
adjective in reset_type_names[] it takes (or the word order between the
noun "reset" and the adjective may have to be different depending on what
the adjective is), so an example may probaby need to be more like:

   static const char *error_msgs[] = {
       N_("mixed reset is not allowed..."),
       N_("soft reset is not allowed..."),
       ...
   };

   die("%s", _(error_msgs[reset_type]));
That, or we could also solve issues like that to some extent by using
the gettext message context, which the limited gettext.h API doesn't
support yet, it's probably not useful in this case but in others you
could do:

    _("reset-verb", "mixed")

And elsewhere:

    _("reset-noun", "mixed")

And that would turn into:

    msgctxt "reset-verb"
    msgid "mixed"
    msgstr "blandað"

Or something like that.

Anyway, regarding the examples it's the only one of two N_() uses
right now, and the builtin/notes.c example is more subtle, and needs
more explanation.

So out of lazyness I'd prefer to keep it as-is for now.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help