mirror of
https://github.com/git/git.git
synced 2024-11-25 10:54:00 +08:00
git-gui: Support context-sensitive i18n
Ocassionally, one would want to translate the same string used in different contexts in diffrent ways. This patch provides a wrapper for msgcat::mc that trims "@@" and anything coming after it, whether or not the string actually got translated. Proposed-by: Harri Ilari Tapio Liusvaara <hliusvaa@cc.hut.fi> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
parent
c8dd7f62e8
commit
146d73a365
11
git-gui.sh
11
git-gui.sh
@ -86,7 +86,16 @@ if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} {
|
||||
## http://www.gnu.org/software/gettext/manual/html_node/Tcl.html
|
||||
|
||||
package require msgcat
|
||||
namespace import ::msgcat::mc
|
||||
|
||||
proc mc {fmt args} {
|
||||
set fmt [::msgcat::mc $fmt]
|
||||
set cmk [string first @@ $fmt]
|
||||
if {$cmk > 0} {
|
||||
set fmt [string range $fmt 0 [expr {$cmk - 1}]]
|
||||
}
|
||||
return [eval [list format $fmt] $args]
|
||||
}
|
||||
|
||||
::msgcat::mcload $oguimsg
|
||||
unset oguimsg
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user