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

Re: [PATCH v3 2/7] i18n: rebase: mark strings for translation

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Jul 24, 2012, 18:01 UTC
Message-ID
<20120724180138.GF2939@burratino>
In-Reply-To
<b263c2bcc5dd6d611a1e3a4f6a87042d4cdb50aa.1343112786.git.worldhello.net@gmail.com>
Hi,
Jiang Xin wrote:
> Mark strings in git-rebase.sh for translation.
Thanks.
[...]
Show 24 quoted lines
> --- a/git-rebase.sh
> +++ b/git-rebase.sh
> @@ -65,6 +65,7 @@ abort!             abort and check out the original branch
>  skip!              skip current patch and continue
>  "
>  . git-sh-setup
> +. git-sh-i18n
>  set_reflog_action rebase
>  require_work_tree_exists
>  cd_to_toplevel
> @@ -72,11 +73,11 @@ cd_to_toplevel
>  LF='
>  '
>  ok_to_skip_pre_rebase=
> -resolvemsg="
> -When you have resolved this problem run \"git rebase --continue\".
> -If you would prefer to skip this patch, instead run \"git rebase --skip\".
> -To check out the original branch and stop rebasing run \"git rebase --abort\".
> -"
> +resolvemsg=$(gettext '
> +When you have resolved this problem run "git rebase --continue".
> +If you would prefer to skip this patch, instead run "git rebase --skip".
> +To check out the original branch and stop rebasing run "git rebase --abort".
> +')

Functional change: command substitution strips off the trailing newline. Intentional?

Probably it would make sense to do
	resolvemsg="
	$(gettext 'When you have resolved this problem, run "git rebase --continue".
	If you prefer to skip this patch, run "git rebase --skip" instead.
	To check out the original branch and stop rebasing, run "git rebase --abort".')
	"

anyway, so the translators could have fewer newlines at the edges to fuss about.

[...]
Show 6 quoted lines
>  	git diff-files --quiet --ignore-submodules || {
> -		echo "You must edit all merge conflicts and then"
> -		echo "mark them as resolved using git add"
> +		echo "$(gettext "You must edit all merge conflicts and then
> +mark them as resolved using git add")"
>  		exit 1
Nice.
[...]
Show 18 quoted lines
> @@ -367,15 +368,16 @@ esac
>  # Make sure no rebase is in progress
>  if test -n "$in_progress"
>  then
> -	die '
> -It seems that there is already a '"${state_dir##*/}"' directory, and
> +	state_dir_base=${state_dir##*/}
> +	die "$(eval_gettext "
> +It seems that there is already a \$state_dir_base directory, and
>  I wonder if you are in the middle of another rebase.  If that is the
>  case, please try
>  	git rebase (--continue | --abort | --skip)
>  If that is not the case, please
> -	rm -fr '"$state_dir"'
> +	rm -fr \"\$state_dir\"
>  and run me again.  I am stopping in case you still have something
> -valuable there.'
> +valuable there.")"

Maybe, to allow changing the commands without having to update translations:

	state_dir_base=...
	cmd_live_rebase='git rebase (--continue | --abort | --skip)'
	cmd_clear_stale_rebase="rm -fr \"$state_dir\""
	die "
	$(eval_gettext 'It seems that there is already a $state_dir_base directory, and
	I wonder if you ware in the middle of another rebase.  If that is the
	case, please try
		$cmd_live_rebase
	If that is not the case, please
		$cmd_clear_stale_rebase
	and run me again.  I am stopping in case you still have something
	valuable there.')"
[...]
> --- a/t/t3400-rebase.sh
> +++ b/t/t3400-rebase.sh
> @@ -68,24 +68,24 @@ test_expect_success 'rebase against master' '

Thanks for updating tests! The expected output you had to change all seems to be intended for humans, which is a good sign.

[...]
Show 9 quoted lines
> --- a/t/t3406-rebase-message.sh
> +++ b/t/t3406-rebase-message.sh
> @@ -64,7 +64,7 @@ test_expect_success 'rebase -n overrides config rebase.stat config' '
>  
>  test_expect_success 'rebase --onto outputs the invalid ref' '
>  	test_must_fail git rebase --onto invalid-ref HEAD HEAD 2>err &&
> -	grep "invalid-ref" err
> +	test_i18ngrep "invalid-ref" err
>  '

This is probably part of a message intended for humans, but the test does not say. What is the full message being checked?

Hope that helps, Jonathan

Previous: Stefano LattariniNext: Junio C Hamano
Message 24 of 28 in “i18n for git-am, git-rebase and git-merge”
  1. 0/7 i18n for git-am, git-rebase and git-mergeJiang Xin, Jul 24, 2012
  2. 1/7 i18n: New keywords for xgettext extraction from shJiang Xin, Jul 24, 2012
  3. 2/7 i18n: rebase: mark strings for translationJiang Xin, Jul 24, 2012
  4. 3/7 i18n: Rewrite gettext messages start with dashJiang Xin, Jul 24, 2012
  5. 4/7 Remove obsolete LONG_USAGE which breaks xgettextJiang Xin, Jul 24, 2012
  6. 5/7 i18n: am: mark more strings for translationJiang Xin, Jul 24, 2012
  7. 6/7 Remove unused and bad gettext block from git-amJiang Xin, Jul 24, 2012
  8. 7/7 i18n: merge-recursive: mark strings for translationJiang Xin, Jul 24, 2012
  9. Stefano LattariniJul 24, 2012
  10. Jonathan NiederJul 24, 2012
  11. Junio C HamanoJul 24, 2012
  12. Martin von ZweigbergkJul 24, 2012
  13. Junio C HamanoJul 24, 2012
  14. Jonathan NiederJul 24, 2012
  15. Junio C HamanoJul 24, 2012
  16. Jonathan NiederJul 24, 2012
  17. Junio C HamanoJul 24, 2012
  18. Thomas RastJul 25, 2012
  19. Jiang XinJul 24, 2012
  20. Jonathan NiederJul 24, 2012
  21. Junio C HamanoJul 24, 2012
  22. Stefano LattariniJul 24, 2012
  23. Stefano LattariniJul 24, 2012
  24. Jonathan NiederJul 24, 2012
  25. Junio C HamanoJul 24, 2012
  26. Jiang XinJul 24, 2012
  27. Stefano LattariniJul 24, 2012
  28. Jonathan NiederJul 24, 2012

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.