Skip to Content
Author's profile photo Former Member

Why you shouldn’t use resource bundles with similar names

In this blog I would like to discuss a simple work around for a program limitation.

Background:

Using resource bundles enables portal applications to be displayed in different languages, you can create resource bundles that hold all language- or country-specific text strings or other resources.

In addition, you can create different resource bundles for each locale-country combination that you want to support, and then add these resource bundles to your WAR file. Your components can retrieve strings or other resources from these files.

Adding resource bundles to war file:

To add your resource bundles to a war file you need to:

  • Place resource bundles in PORTAL-INF/private/lib (when packaged in JAR files) or in PORTAL-INF/private/classes (as individual files). The file extension is .properties.

/wp-content/uploads/2013/03/1_194307.png

  • Define the name of the runtime resource bundle in the ResourceBundleName profile property in the portalapp.xml file.

/wp-content/uploads/2013/03/2_194308.png

For more information about using resource bundles please refer to http://help.sap.com

(http://help.sap.com/saphelp_nw73/helpdata/en/49/dba57d5dba551de10000000a42189c/content.htm)

Limitation description:

When loading two resource bundle files that one of the file names contains the name of the other file, the system will load the values from the last loaded file only.

For example:  If one of the file’s name is “ResourceBundleFileName.properties”, and the other file’s name is “NewResourceBundleFileName.properties”, and the second one was loaded last,

/wp-content/uploads/2013/03/3_194309.png

Only values from NewResourceBundleFileName.properties will be used.

Suggested Workaround:

In order to avoid this situation, make sure that the names of your resource bundle files are different and avoid situation where one file name contains the name of the another file name.

As demonstrated below – none of the file’s names contains the name of another file.

/wp-content/uploads/2013/03/4_194310.png

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Tobias Hofmann
      Tobias Hofmann

      Thanks for sharing.

      This limitation is because of Java or NetWeaver specific?

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Hi Tobias

      This is a NewWeaver specific limitation