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

Re: [PATCH 14/21] i18n: rebase-interactive: mark strings for translation

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 21, 2016, 12:57 UTC
Message-ID
<CACBZZX7T7b9xMM_mDcH6JBnuCap7RtKvSYoFNDrN5mLdmLLYHQ@mail.gmail.com>
In-Reply-To
<1463585274-9027-15-git-send-email-vascomalmeida@sapo.pt>
On Wed, May 18, 2016 at 5:27 PM, Vasco Almeida <vascomalmeida@sapo.pt> wrote:
> Mark strings in git-rebase--interactive.sh for translation. There is no
> need to source git-sh-i18n since git-rebase.sh already does so.
Cool, thanks for working on this.
Show 11 quoted lines
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -128,7 +128,7 @@ mark_action_done () {
>         if test "$last_count" != "$new_count"
>         then
>                 last_count=$new_count
> -               printf "Rebasing (%d/%d)\r" $new_count $total
> +               printf "$(gettext Rebasing) (%d/%d)\r" $new_count $total
>                 test -z "$verbose" || echo
>         fi
>  }

Things like these should be converted into something you can pass to eval_gettext. I.e. For any message the translator needs to be able to translate the whole message. Consider e.g. RTL languages where the (%d/%d) will be on the right-hand-side of the message.

Show 16 quoted lines
> @@ -201,11 +201,13 @@ exit_with_patch () {
>         make_patch $1
>         git rev-parse --verify HEAD > "$amend"
>         gpg_sign_opt_quoted=${gpg_sign_opt:+$(git rev-parse --sq-quote "$gpg_sign_opt")}
> -       warn "You can amend the commit now, with"
> +       # TRANSLATORS: after this line is a command to be issued by the user
> +       warn "$(gettext "You can amend the commit now, with")"
>         warn
>         warn "  git commit --amend $gpg_sign_opt_quoted"
>         warn
> -       warn "Once you are satisfied with your changes, run"
> +       # TRANSLATORS: after this line is a command to be issued by the user
> +       warn "$(gettext "Once you are satisfied with your changes, run")"
>         warn
>         warn "  git rebase --continue"
>         warn

Stuff like this should be one big call to gettext. I.e. everything from "You can amend" up to and including "--continue". Even if the translators probably don't want to change the order here it helps a lot to have the extra context. I.e. do it like ...

Show 15 quoted lines
> @@ -536,10 +543,11 @@ do_next () {
>                 mark_action_done
>                 do_pick $sha1 "$rest"
>                 git commit --amend --no-post-rewrite ${gpg_sign_opt:+"$gpg_sign_opt"} || {
> -                       warn "Could not amend commit after successfully picking $sha1... $rest"
> -                       warn "This is most likely due to an empty commit message, or the pre-commit hook"
> -                       warn "failed. If the pre-commit hook failed, you may need to resolve the issue before"
> -                       warn "you are able to reword the commit."
> +                       warn "$(eval_gettext "\
> +Could not amend commit after successfully picking \$sha1... \$rest
> +This is most likely due to an empty commit message, or the pre-commit hook
> +failed. If the pre-commit hook failed, you may need to resolve the issue before
> +you are able to reword the commit.")"
>                         exit_with_patch $sha1 1
>                 }
... this! :)
Show 9 quoted lines
> @@ -607,7 +615,7 @@ do_next () {
>         x|"exec")
>                 read -r command rest < "$todo"
>                 mark_action_done
> -               printf 'Executing: %s\n' "$rest"
> +               printf "$(gettext Executing:) %s\n" "$rest"
>                 "${SHELL:-@SHELL_PATH@}" -c "$rest" # Actual execution
>                 status=$?
>                 # Run in subshell because require_clean_work_tree can die.

Ditto my first comment about the whole thing needing to be a call to eval_gettext. I.e. also that " %s" part.

Show 21 quoted lines
> -                       warn "You can fix the problem, and then run"
> +                       # TRANSLATORS: after this line is a command to be issued by the user
> +                       warn "$(gettext "You can fix the problem, and then run")"
>                         warn
>                         warn "  git rebase --continue"
>                         warn
> @@ -630,9 +639,11 @@ do_next () {
>                         exit "$status"
>                 elif test "$dirty" = t
>                 then
> -                       warn "Execution succeeded: $rest"
> -                       warn "but left changes to the index and/or the working tree"
> -                       warn "Commit or stash your changes, and then run"
> +                       # TRANSLATORS: after these lines is a command to be issued by the user
> +                       warn "$(eval_gettext "\
> +Execution succeeded: \$rest
> +but left changes to the index and/or the working tree
> +Commit or stash your changes, and then run")"
>                         warn
>                         warn "  git rebase --continue"
>                         warn

Both ditto the above. I.e. just include the command to be issued in the message. Then you can also skip the TRANSLATORS comment since this won't be confusing to them anymore.

Show 32 quoted lines
> @@ -991,28 +1002,26 @@ check_todo_list () {
>                 then
>                         test "$check_level" = error && raise_error=t
>
> -                       warn "Warning: some commits may have been dropped" \
> -                               "accidentally."
> -                       warn "Dropped commits (newer to older):"
> +                       warn "$(gettext "\
> +Warning: some commits may have been dropped accidentally.
> +Dropped commits (newer to older):")"
>
>                         # Make the list user-friendly and display
>                         opt="--no-walk=sorted --format=oneline --abbrev-commit --stdin"
>                         git rev-list $opt <"$todo".miss | warn_lines
>
> -                       warn "To avoid this message, use \"drop\" to" \
> -                               "explicitly remove a commit."
> -                       warn
> -                       warn "Use 'git config rebase.missingCommitsCheck' to change" \
> -                               "the level of warnings."
> -                       warn "The possible behaviours are: ignore, warn, error."
> +                       warn "$(gettext "\
> +To avoid this message, use \"drop\" to explicitly remove a commit.
> +
> +Use 'git config rebase.missingCommitsCheck' to change the level of warnings.
> +The possible behaviours are: ignore, warn, error.")"
>                         warn
>                 fi
>                 ;;
>         ignore)
>                 ;;
>         *)

Making this into one big eval_gettext where we stash away those "newer to older" commits into a variable would be easier on translators, but maybe there are performance considerations and we could just live with two messages. Not sure how large this list might get in practice.

I haven't tried to apply & run this patch. But aside from the chunks I commented on the rest of this looks fine to me.

Previous: Eric SunshineNext: Vasco Almeida
Message 25 of 42 in “i18n and tests updates”
  1. 00/21 i18n and tests updatesVasco Almeida, May 18, 2016
  2. 01/21 i18n: builtin/remote.c: fix mark for translationVasco Almeida, May 18, 2016
  3. 02/21 i18n: advice: mark string about detached head for translationVasco Almeida, May 18, 2016
  4. 03/21 i18n: advice: internationalize message for conflictsVasco Almeida, May 18, 2016
  5. Eric SunshineMay 18, 2016
  6. Vasco AlmeidaMay 18, 2016
  7. Junio C HamanoMay 18, 2016
  8. 04/21 i18n: transport: mark strings for translationVasco Almeida, May 18, 2016
  9. 05/21 i18n: sequencer: mark entire sentences for translationVasco Almeida, May 18, 2016
  10. Eric SunshineMay 18, 2016
  11. Vasco AlmeidaMay 18, 2016
  12. Ævar Arnfjörð BjarmasonMay 21, 2016
  13. Junio C HamanoMay 23, 2016
  14. Eric SunshineMay 23, 2016
  15. 06/21 i18n: sequencer: mark string for translationVasco Almeida, May 18, 2016
  16. 07/21 i18n: merge-octopus: mark messages for translationVasco Almeida, May 18, 2016
  17. 08/21 merge-octupus: use die shell function from git-sh-setup.shVasco Almeida, May 18, 2016
  18. 09/21 i18n: rebase: fix marked string to use eval_gettext variantVasco Almeida, May 18, 2016
  19. 10/21 i18n: rebase: mark placeholder for translationVasco Almeida, May 18, 2016
  20. 11/21 i18n: bisect: simplify error message for i18nVasco Almeida, May 18, 2016
  21. 12/21 t6030: update to use test_i18ncmpVasco Almeida, May 18, 2016
  22. 13/21 i18n: git-sh-setup.sh: mark strings for translationVasco Almeida, May 18, 2016
  23. 14/21 i18n: rebase-interactive: mark strings for translationVasco Almeida, May 18, 2016
  24. Eric SunshineMay 19, 2016
  25. Ævar Arnfjörð BjarmasonMay 21, 2016
  26. Vasco AlmeidaMay 21, 2016
  27. 15/21 i18n: rebase-interactive: mark here-doc strings for translationVasco Almeida, May 18, 2016
  28. 16/21 i18n: rebase-interactive: mark comments of squash for translationVasco Almeida, May 18, 2016
  29. 17/21 tests: use test_i18n* functions to suppress false positivesVasco Almeida, May 18, 2016
  30. 18/21 tests: unpack-trees: update to use test_i18n* functionsVasco Almeida, May 18, 2016
  31. 19/21 t9003: become resilient to GETTEXT_POISONVasco Almeida, May 18, 2016
  32. Eric SunshineMay 19, 2016
  33. Vasco AlmeidaMay 19, 2016
  34. Eric SunshineMay 20, 2016
  35. Junio C HamanoMay 20, 2016
  36. Eric SunshineMay 20, 2016
  37. Vasco AlmeidaMay 20, 2016
  38. Junio C HamanoMay 20, 2016
  39. Junio C HamanoMay 20, 2016
  40. Vasco AlmeidaMay 20, 2016
  41. 20/21 t4153: fix negated test_i18ngrep callVasco Almeida, May 18, 2016
  42. 21/21 t5523: use test_i18ngrep for negationVasco Almeida, May 18, 2016

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.