Hi Craig,
Please have a look at java.text.MessageFormat -- it is exactly what you need.
A very quick example:
String strTextTemplate = "{1} of {2} steps";
String strText = MessageFormat.format(strTextTemplate, new String[] { nCurrentStep, nTotalSteps });
It is designed precisely with i18n in mind. It also provides a number of other useful tricks.
Best regards,
-mb
Craig Miskell <[EMAIL PROTECTED]> wrote:
Hi,
Just wondering what other people are doing with constructing
internationalized strings. What I mean is, say you want to inform how
far through a process you are by displaying a string which, in English
comes out in the form
"x of y steps"
where x and y must be supplied programmatically at runtime.
Given that we can't rely on the order of words in other languages, I can't
localize just the "of" and "steps" seperately, unless I want to come up
with a really odd looking translation in some languages. :-)
My current plan is to make the localized string contain %x and %y which
should be replaced with the relevant data. Obviously I can code this up
each time, and I can even end up doing it generically.
But has it been done before, and can I save a little time? Or is this
something I can contribute to the community once it's done?
Thanks,
Craig
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Tapestry-developer mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/tapestry-developer
Do you Yahoo!?
U2 on LAUNCH - Exclusive medley & videos from Greatest Hits CD
