As a sub-task and first step towards completely and dynamically localizing page and tool titles, apply Mark Norton's
SAK-8908 branch that localizes tool titles.
- Implementation notes from Mark Norton **
After extensive experimentation, I have checked a fix into the
SAK-8908 branch of the kernel. Several different methods were attempted to provide tool title localization. Problems with reaching resource bundles in tool packages vs. the central shared space prevented ResourceLoader from being used.
Local tool titles are put in a file named using the format of [toolId][_][localCode].properties in the /tool/ directory of a Sakai application. Title properties have a key of "title".
The ToolListener was modified to detect the above files and add them to a map in the Tool manager implementation via a new API method called setResourceBundle(). This method was added to the ToolMaanager API, both covers (ToolManager and ActiveToolManager) and implemented in ToolComponent. The implementation maintains a Map of locale codes to Properties objects. The default properties set is called DEFAULT.
A three tier access method is implemented in Tool.getTitle:
1. If a central tool resource bundle exists, return that localized title.
2. If a localized tool resource exists, return that localized title.
3. Otherwise default to the tool title in the tool registration file (not localized).
Additionally, a change was made to the Placement implementation. Placement maintains a copy of the tool title and is initialized in the register() methods of the ToolManager before the ToolListener loads local tool resources. The order of fetching the title was reversed. It now checks for a tool title using getTitle() before using the local copy.
In all, the following files were modified for this fix:
These were checked into SVN as revs 51546 to 51552.
NOTE: These changes only localize tool titles. They do not attempt to localize page names, which is a harder problem. Furthermore, tool descriptions are not currently localized.