AW: [opencms-dev] NewsModule again / Localisation

Andreas Zahner A.Zahner at alkacon.com
Tue Mar 11 15:57:47 CET 2003


Felix,

The Resource Bundles for the Backoffice labels have to be placed in the
"classes" subfolder of your module. If your module is named
"com.module.new", a file "workplace.properties" has to be created in the
subfolder "classes/com/module/my/" of this module. 
(The News module is not capable of exporting the classes folder to the
filesystem automatically, so after creating your Resource Bundles, you
have to export them manually to the "WEB-INF/classes/" folders in your
Tomcat webapp folder. Only modules of the "Simple" type can do that
export automatically when you are publishing.)

The keys have to be named like the XML tags in the legacy XMl
localiziation , e.g the label
"<myBackoffice><label><id>ID</id></label></myBackoffice>" must be
transformed to the key "myBackoffice.label.id=ID".

For every used language, you have to create an extra file, e.g for the
german localization "workplace_de.properties". If a key is not found in
the localized Resource Bundle, OpenCms looks for it in the default
"workplace.properties" file.

Don't forget to publish the files and restart OpenCms/Tomcat after every
change to the Resource Bundles so that you can see your changes.

Regards,

Andreas Zahner
Alkacon Software - The OpenCms Experts
http://www.alkacon.com 


-----Ursprüngliche Nachricht-----
Von: owner-opencms-dev at www.opencms.org
[mailto:owner-opencms-dev at www.opencms.org] Im Auftrag von Felix Engel
Gesendet: Dienstag, 11. März 2003 15:26
An: Opencms Development list
Betreff: [opencms-dev] NewsModule again / Localisation


Hello,

I took some more time to investigate the missing labels that occur when
installing NewsModule V4 on an V5.0_rc2 server. The problem seems to be
located in the localisation, which has changed from the proprietary XML
Format used in pre V5.0 versions to a standard java.util.Resource Bundle
technology. A <LABEL .../> tag is resolved by the function

/**
 * Returns the language value of the requested label key.<p>
 *
 * @param keyName the key for the desired string
 * @return the resource string for the given key
 */
 public String getLanguageValue(String keyName)

The Bundle is, in my understanding, initialized in

 /**
   * Gathers all localization files for the workplace from the
	* different modules.<p>
	*
   * For a module named "my.module.name" the locale file
	* must be named
	* "my.module.name.workplace" and be located in
	* the classpath so that the resource loader
   * can find it.<p>
   *
   * @param cms for accessing system
   * resources
   */
private synchronized Set collectModuleMessages(CmsObject cms, String
locale)

If I understood something wrongly, pleas correct me.

I have then tried to create a resource file and make it available to 
the system, however I did not find a combination where the system was
able to correctly resolve the given Resources. Especially I am not sure
what "classpath" refers to in the above comment. Is it on the server
Filesystem or in the VFS ? And how do I find out the "classpath", if it
is in the vfs.

Any ideas will be greatly apreciated.

Regards, Felix


		 


-- 
Fourth Law of Revision:
	It is usually impractical to worry beforehand about
interferences -- if you have none, someone will make one for you.




More information about the opencms-dev mailing list