Re: i18n bis
Raoul Pierre <[email protected]>
| Newsgroups | gmane.comp.java.keel.devel |
|---|---|
| Message-ID | <[email protected]> |
I'm just thinking that a little howto would be nice. As before, the controller looks through the response and translates any Keel "Message" objects it finds, as well as any strings that begin with "$". To begin a string with "$" and not have it internationalized, just use "$$". This will be converted to a single "$" for display. What I added: - each Response Element can have an attribut "bundle" that specifies a bundle key; - if a Response Element doesn't have such an attribut, it takes the bundle key of his last parent that has one (but it ignores any "bundle" attribut of a Keel Message), What that means: to translate a message in a response, it uses, by decreasing priority order, the bundle specified by a key in a valid "bundle" attribute of: - a Keel "Message" object embedded in the Response Element, - the Response Element, - a Response Element's parent. - the model response Otherwise: - it checks the name of the model that generated the response; if it starts with a valid bundle key and a dot, then it uses it E.g. if the argument is the name of a model beginning with "poll.", it looks for a bundle under the key "poll". - by default, it uses the bundle given by Globals.MESSAGES_KEY, e.g. "ApplicationResources.properties" Like this, it's possible to use together as many models as required, e.g. app-crud with app-navigate. And to keep the messages of each ones in specific resource files, e.g. in respective directory of the different modules. Nota: I didn't try it, but it should be possible to specify a bundle attribut for a string message without starting "$". Then it's the responsability of the JSP page to get the right message resources. With struts tags, there wouldn't be any problem. With JSTL tags, bundle basename must be deduced from the bundle key. Pierre http://keelframework.org/documentation.shtml Keelgroup mailing list [email protected] http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com