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

Re: [PATCH 2/5] Internationalization of git-gui

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jul 22, 2007, 07:45 UTC
Message-ID
<20070722074525.GX32566@spearce.org>
In-Reply-To
<200707211434.56622.stimming@tuhh.de>
Christian Stimming <stimming@tuhh.de> wrote:
> Subject: [PATCH] Mark strings for translation.
> 
> The procedure [mc ...] will translate the strings through msgcat.
...
> Here I marked much more strings than in the previous patch, and as discussed
> the procedure [mc ...] is used for translation. Actually I think this pretty much 
> caught all occurrences of user-visible strings in *this* file; there will be many
> more strings in all the other files, of course.

Almost. I noticed two that you did miss, and its because they are totally weird. We may want to rewrite this block of code first...

Show 18 quoted lines
> @@ -1673,7 +1673,7 @@ if {[is_enabled transport]} {
>  menu .mbar.repository
>  
>  .mbar.repository add command \
> -	-label {Browse Current Branch's Files} \
> +	-label [mc "Browse Current Branch's Files"] \
>  	-command {browser::new $current_branch}
>  trace add variable current_branch write ".mbar.repository entryconf [.mbar.repository index last] -label \"Browse \$current_branch's Files\" ;#"
>  .mbar.repository add command \
> @@ -1682,69 +1682,69 @@ trace add variable current_branch write ".mbar.repository entryconf [.mbar.repos
>  .mbar.repository add separator
>  
>  .mbar.repository add command \
> -	-label {Visualize Current Branch's History} \
> +	-label [mc "Visualize Current Branch's History"] \
>  	-command {do_gitk $current_branch}
>  trace add variable current_branch write ".mbar.repository entryconf [.mbar.repository index last] -label \"Visualize \$current_branch's History\" ;#"
>  .mbar.repository add command \

See those two trace lines? These things are setting up hooks to change the menu item's label on the fly, so that the current branch name is shown in the item label. These will also need to use mc to translate the string. But they are in a double quoted string and will be eval'd later by Tcl, so we actually need something like:

- trace add variable current_branch write ".mbar.repository entryconf [.mbar.repository index last] -label \"Visualize \$current_branch's History\" ;#"
+ trace add variable current_branch write ".mbar.repository entryconf [.mbar.repository index last] -label \[mc \"Visualize \$current_branch's History\"\] ;#"

These are (I think) the only two places in all of git-gui where this wierdness happens. Converting this trace pair to a normal procedure may make it easier to manage for translation.

> -	.mbar.apple add command -label "About [appname]" \
> +	.mbar.apple add command -label [mc "About %s" appname] \
Bug. This needs to be:
+	.mbar.apple add command -label [mc "About %s" [appname]] \

You lost one level of [] there when you did the replacement. I only noticed this during a fast scan through while deleting text. I'll have to reread this patch more carefully later, before I apply (or merge) it, to make sure we don't have more such cases.

-- 
Shawn.
Previous: Johannes SchindelinNext: Christian Stimming
Message 28 of 48 in “Re: [PATCH] Internationalization of git-gui”
  1. Brett SchwarzJul 19, 2007
  2. Shawn O. PearceJul 20, 2007
  3. Christian StimmingJul 20, 2007
  4. Shawn O. PearceJul 21, 2007
  5. Christian StimmingJul 21, 2007
  6. Shawn O. PearceJul 21, 2007
  7. Christian StimmingJul 21, 2007
  8. Christian StimmingJul 21, 2007
  9. Christian StimmingJul 21, 2007
  10. Christian StimmingJul 21, 2007
  11. Christian StimmingJul 21, 2007
  12. David KastrupJul 21, 2007
  13. Simon 'corecode' SchubertJul 21, 2007
  14. David KastrupJul 21, 2007
  15. Christian StimmingJul 21, 2007
  16. Christian StimmingJul 21, 2007
  17. David KastrupJul 21, 2007
  18. Christian StimmingJul 22, 2007
  19. Edgar ToernigJul 22, 2007
  20. Christian StimmingJul 23, 2007
  21. David KastrupJul 21, 2007
  22. Shawn O. PearceJul 22, 2007
  23. Junio C HamanoJul 22, 2007
  24. Christian StimmingJul 22, 2007
  25. Johannes SchindelinJul 22, 2007
  26. Christian StimmingJul 22, 2007
  27. Johannes SchindelinJul 22, 2007
  28. Shawn O. PearceJul 22, 2007
  29. Christian StimmingJul 22, 2007
  30. Johannes SchindelinJul 21, 2007
  31. Junio C HamanoJul 21, 2007
  32. Christian StimmingJul 21, 2007
  33. Johannes SchindelinJul 21, 2007
  34. Junio C HamanoJul 21, 2007
  35. Johannes SchindelinJul 21, 2007
  36. Christian StimmingJul 22, 2007
  37. Johannes SchindelinJul 22, 2007
  38. Add glossary that can be converted into a po file for each language.Christian Stimming, Jul 23, 2007
  39. Junio C HamanoJul 24, 2007
  40. Junio C HamanoJul 24, 2007
  41. Christian StimmingJul 24, 2007
  42. Johannes SchindelinJul 21, 2007
  43. Junio C HamanoJul 21, 2007
  44. Johannes SchindelinJul 21, 2007
  45. Shawn O. PearceJul 22, 2007
  46. Christian StimmingJul 23, 2007
  47. Shawn O. PearceJul 24, 2007
  48. Christian StimmingJul 20, 2007

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.