git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Alangi Derick <alangiderick@gmail.com>, Git List <git@vger.kernel.org>
Subject: Re: [PATCH] fixed translation errors
Date: Mon, 4 May 2015 19:38:53 -0400	[thread overview]
Message-ID: <CAPig+cTHqwsmk4xiHG3v6d9uwTmz08NFP0mihRdnTiXQe5E68Q@mail.gmail.com> (raw)
In-Reply-To: <5547675a.274ec20a.69fb.ffffce22@mx.google.com>

On Sun, May 3, 2015 at 6:19 PM, Alangi Derick <alangiderick@gmail.com> wrote:
> Signed-off-by: Alangi Derick <alangiderick@gmail.com>
> ---
> diff --git a/builtin/apply.c b/builtin/apply.c
> index 0769b09..66d2aba 100644
> --- a/builtin/apply.c
> +++ b/builtin/apply.c
> @@ -2237,7 +2237,7 @@ static void update_pre_post_images(struct image *preimage,
>         if (postlen
>             ? postlen < new - postimage->buf
>             : postimage->len < new - postimage->buf)
> -               die("BUG: caller miscounted postlen: asked %d, orig = %d, used = %d",
> +               die(_("BUG: caller miscounted postlen: asked %d, orig = %d, used = %d"),
>                     (int)postlen, (int) postimage->len, (int)(new - postimage->buf));

This condition represents a bug in Git itself, which should never
trigger. As such, there's probably very little value in having it
translated, and doing so would make extra work for those translating
the messages.

>         /* Fix the length of the whole thing */
> @@ -3342,7 +3342,7 @@ static int load_current(struct image *image, struct patch *patch)
>         unsigned mode = patch->new_mode;
>
>         if (!patch->is_new)
> -               die("BUG: patch to %s is not a creation", patch->old_name);
> +               die(_("BUG: patch to %s is not a creation"), patch->old_name);

Ditto: Internal Git error.

>         pos = cache_name_pos(name, strlen(name));
>         if (pos < 0)
> @@ -3572,7 +3572,7 @@ static int check_to_create(const char *new_name, int ok_if_exists)
>
>                 return EXISTS_IN_WORKTREE;
>         } else if ((errno != ENOENT) && (errno != ENOTDIR)) {
> -               return error("%s: %s", new_name, strerror(errno));
> +               return error(_("%s: %s"), new_name, strerror(errno));

There isn't a whole lot here for translators to work with; no context
or indication of what this message is about. (Perhaps the only thing a
translator can do is adjust whitespace around the colon.) This might
be the sort of case where you want to submit a separate patch which
both fleshes out this error message with enough context for
translators to sink their teeth into, and make the string
translatable.

>         }
>         return 0;
>  }
> @@ -4599,9 +4599,9 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
>                         apply_usage, 0);
>
>         if (apply_with_reject && threeway)
> -               die("--reject and --3way cannot be used together.");
> +               die(("--reject and --3way cannot be used together."));
>         if (cached && threeway)
> -               die("--cached and --3way cannot be used together.");
> +               die(("--cached and --3way cannot be used together."));

You forgot the '_' in '_(...)' on both of these.

>         if (threeway) {
>                 if (is_not_gitdir)
>                         die(_("--3way outside a repository"));
> @@ -4659,8 +4659,8 @@ int cmd_apply(int argc, const char **argv, const char *prefix_)
>                                whitespace_error),
>                             whitespace_error);
>                 if (applied_after_fixing_ws && apply)
> -                       warning("%d line%s applied after"
> -                               " fixing whitespace errors.",
> +                       warning(_("%d line%s applied after"
> +                               " fixing whitespace errors."),
>                                 applied_after_fixing_ws,
>                                 applied_after_fixing_ws == 1 ? "" : "s");

This sort of pluralization (adding "s") only works in some languages.
To translate this properly use Q_(...). See [1] for details, as well
as existing uses of Q_(...) in Git.

[1]: http://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/Plural-forms.html

>                 else if (whitespace_error)
> --
> 2.4.0.2.g3386abe.dirty

      parent reply	other threads:[~2015-05-04 23:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-03 22:19 [PATCH] fixed translation errors Alangi Derick
2015-05-04 17:39 ` Stefan Beller
2015-05-04 23:38 ` Eric Sunshine [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPig+cTHqwsmk4xiHG3v6d9uwTmz08NFP0mihRdnTiXQe5E68Q@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=alangiderick@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).