[interchange-cvs] CVS notice: activity by jon
interchange-cvs@lists.akopia.com
interchange-cvs@lists.akopia.com
Sun Jul 1 01:07:00 2001
CVS activity by user 'jon':
interchange/lib/Vend Interpolate.pm,1.40.2.90,1.40.2.91 Parse.pm,1.12.2.27,1.12.2.28
Update of /var/cvs/interchange/lib/Vend
In directory interchange.redhat.com:/tmp/cvs-serv31033
Modified Files:
Tag: DEV_4_7_0
Interpolate.pm Parse.pm
Log Message:
Added new core [msg] tag based on Stefan and Mike's ideas for doing
parse-time locale substitutions. Some examples follow.
Using message string key if available, and multiple-value printf replacement:
[msg
key=540
arg.0="[data session username]"
arg.1="[scratch wahnsinn]"
raw=0
]
User %s is approximately %s%% crazy.
[/msg]
Using [LC]-style inline translations with a single printf replacement:
[msg
arg="[scratch wahnsinn]"
inline=1 # can also use attribute 'lc' as an alias for inline
]
This user has earned %s crazy points.
[de_DE]Dieser Benutzer hat %s Wahnsinnspunkte verdient.[/de_DE]
[/msg]
Using a forced locale setting with no printf replacement:
[msg
locale=de_DE
raw=1
]
Thi%s will be tran%slated to German without any printf-ing.
[/msg]
(Note that forcing locale=something currently doesn't make any sense
in the admin UI, since usertag [mm-locale] erases $Vend::Cfg->{Locale_
repository} before it loads in the global locale, so there isn't any
other locale to switch to. Maybe it shouldn't do this?)
And probably just for fun, using a hash-based arglist, with printf string
substitutions ordered by sorted hash keys:
[msg
arg.a=10
arg.b=20
]
A slightly nuttier example (with values %s and %s).
[/msg]
Commentary, corrections, and enhancements are of course welcome.
If everyone's ok with this and it tests out ok, I'll add it to the SDF
documentation.