i18n

Raoul Pierre <[email protected]> Fri, 26 Aug 2005 12:39:07 +0200
Newsgroups gmane.comp.java.keel.devel
Message-ID <[email protected]>
Hello,

I just commited patches to move dynamic message from clnt-struts to 
keel-client.

The treatment of dynamic messages is now implanted in 
DefaultClientConnector. The job is done by an new class 
DynamicMessageSupport in keel-common, with Apache library commons-resources.

I moved the properties files from conf/client/struts to 
conf/clients/resource, a more client neutral place. I used 
ResourceBundle Editor for Eclipse to sort the messages: very nice tool 
to work with i18n messages.

Howto :

Below "key" is the symbolic name of a bundle.

- In each direct sub-class of DefaultClientConnector, defined a function 
setDefaultKeys, which can add  key(s) to the default key list. This 
function can be called from function "execute" as soon as kres is 
defined with a "model" attribute (if required).
  This function "setDefaultKeys" must call:
  * DefaultClientConnector.initDefaultKeys(kres) to initialize the 
default key list,
  * then DefaultClientConnector.getDefaultKeys() to get this default key 
list and add new key(s).
 
  Use DefaultClientConnector.addFirstDefaultKey(...) and 
DefaultClientConnector.addLastDefaultKey(...)  to add any key at the 
beginning or at the end of the list.
  It is recommended to defined setDefaultKeys as private.

- In a derived class, e.g. StrutsClientConnector, in function "execute"  
insert a call to DefaultClientConnector.internationalize(...). This 
function will do all the job!

  It is also possible to call 
DefaultClientConnector.translateString(...), like StrutsClientConnector 
with the error messages.

  Normally,  sub-classes don't need to do anything else about i18n but 
eventually to define their own function setDefaultKeys.
 
====

AbstractDesktopClientConnector is ready to i18n.

Todo:
- put i18n in non Struts Client connectors
- it may be necessary to add script(s) in plugin.jelly 
(tool-maven-plugin) for clients other than Struts.
- add a function "translateMessage" in DefaultClientConnector.
- in StrutsClientConnector.errorhandle,  do a "final" translation of 
error messages.

Pierre



http://keelframework.org/documentation.shtml
Keelgroup mailing list
[email protected]
http://lists.keelframework.com/listinfo.cgi/keelgroup-keelframework.com