On 10-04-15 2:01 PM, Bryan Kearney wrote:
Cool.. couple of questions:
On 04/15/2010 12:38 PM, Dmitri Dolguikh wrote:
> changes are in. Here's the skinny:
>
> - there's a new dependency in the build: gettext-commons
> - there are new targets in the build: extractkeys - extracts strings
> that need to be localized, mergekeys - performs a merge on the existing
> .po files, createresourcebundles - compiles resource bundles
> - localized resource bundles can be found in
> localized_resources/classes/ directory
>
Is there a way to identify the keys which have not yet been translated?
look at the actual .po file and see what msgstr's are empty (and what
keys they correspond to). I can do a buildr task for that.
> - if you're running tomcat from under eclipse, you'll need to the above
> directory into tomcat's classpath
>
> how to use it (development):
> inject I18n (there's a I18n provider) instance in the classes that will
> have user-visible text. Then (assuming instance variable name is i18n):
>
I assume still open to do is to yank the locale off of the current request?
Nope. done. (see I18nProvider)
> <snip>
> i18n.tr("goodbye, cruel world.");
> </snip>
>
So. best practice is to use tr("string with {0}", variable) ??
correct.
Also... I assume since it is scanning for .tr() we can not put the
i18n
into the actual exception class?
+1. that's what i discovered earlier this week.
I doubt we could do BadRequestExcepotion.tr("Some text").
Seems like a
hack :)
we could. but i think the current way of dealing with it is cleaner
(keep in mind, we'll have to get the locale from the request in any
case, and that gets messy).
-d