Work to internationalize the platform.Some general points
GUIExternalize text properties from GWT - mostly done. Not done See also http://code.google.com/webtoolkit/doc/latest/DevGuideI18n.html ServerServer messages need to be internationalized by the standard Java Means. In addition to that, message codes need to be supplied,
Das System ist kaputt. Achtung!
we would know that we need to run for shelter. AgentAgent messages need to be internationalized by the standard Java Means. In addition to that, message codes need to be supplied,
Das System ist kaputt. Achtung!
we would know that we need to run for shelter. PluginsThe situation for plugins is a bit different than for Agent or Server proper, as two pieces of data need translations:
Those need to be treated differently, as one consists of metadata and the other of messages generated at runtime. Plugin metadataCurrently plugin metadata like the description or display names of things are stored after parsing in the database. So e.g.
Resource r = ...
ResourceType rt = r.getResourceType();
String description desc = rt.getDescription();
will return the description text that is parsed at plugin parse time and then stored in the database. In order to change that, we need to provide alternate translations in the plugin Options are:
The latter approach has the advantage that plugins can be kept as they are without any need to translate exisiting ones to continue working; in the first case, it is much more clear which key is meant, as this is explicitly given in the ${..} expression. Especially having the ${..} expression present will help to determine what needs to be translated and what not. Next this property needs to be made available to the code.
In any case we need a mechanism to pass in the desired language from the UI / CLI, so that the lower layers can use it to select the translation. As the Subject is passed around from the UI to the lower levels, this could be a good location to attach the desired (and fallback?) locale. Cut through of a clients requestThe next figure shows a cut through from user to database:
When a request comes in via Browser or RESTInterface, the language of the user is determined via content negotiation and attached to the subject, which is then passed into the EJB layer. For the CLI we could introduce a set language command, that allows to set the language for a session. Another option could be to store the desired language for a user with the other users information (name, ..) and always use this pre-defined value (conneg is desired).
@PostLoad
private void changeDescription() {
if (getName().startsWith("%")) {
String newDesc = cache.get(getName().substring(1),threadLocal.getLocale());
setDescription(newDesc);
}
}
The cache itself then gets the respective item and if it is not there, it can use a cache loader to retrieve it from the database in a special translations property table:
Where the primary key is the tuple (key,locale). The table still needs a "link" to the plugin - either implicit via prefix in the key or explicit via fk relation. On server startup, the strings for the default locale will be preloaded into the cache. Deploying metadataThe translations come from properties files bundled with the plugin and need to be stored in the server. To do this, when running the plugin deployer, the properties files are loaded in the server and then written to the database table. On plugin upgrades all old properties are first deleted from the database and then the new translations are just added in a batch. Plugin verifierThe plugin verifier needs to be augmented to check that the ${..} expressions actually at least resolve to a default locale. Plugin builds should fail if not all expressions are satisfied. Messages from codeMessages from code are always directly returned from the running plugin, so that the standard mechanisms of I18N can apply. Meeting minutesDec 21st, 201117:10:14 <jbott> Meeting ended Wed Dec 21 16:09:58 2011 UTC. Information about MeetBot at http://wiki.debian.org/MeetBot . (v 0.1.4) miscThere was some initial work done on generating properties files from plugin metadata. It may not be the best approach though as it parses the plugin xml differently from the PluginMetadataParser. The code is available at org.rhq.core.clientapi.agent.metadata.i18n.PropertiesGenerator.
|
