Saturday, January 8, 2011

Internationalizing Strings


i18n1.png

By default, "commandButton 1" is the name that this button will display.  Now you can change this Text to be a value from your resource bundle and you can also define an AccessKey, something like "Close" with "C" will name your button "Close" with the "C" underlined as your accelerator.  However, if someone later translates "Close" to a language where "C" is no longer part of the new word, then your "C" AccessKey won't work.  What to do? 
Use the TextAndAccessKey field instead.  Click on the little down arrow next to the field and select "Select Text Resource..."
i18n2.png

Then enter your desired value with the AccessKey directly in the string:
i18n3.png    

By using "&" before the letter "C", you are asking that "C" be the AccessKey.  JDeveloper will automatically underline the "C" for you and provide accelerator functionality.  Now if someone were to translate "Close" to another language, they would see that "C" is the AccessKey and they could pick a new AccessKey and not lose the accelerator functionality that JDeveloper provides.

No comments:

Post a Comment