We all love extensions in Cognos. They allow you to add your own customizations through-out the product. Whether it's custom menu items in the toolbar, or custom tabs on the home page, you are only really limited by your imagination.
One thing you may not have know about extensions is that visible strings in extensions can be localized, so your customizations can be translated into the language of the user. And it is actually incredibly easy to achieve, let's see how!
In the extension specification:
If you've worked with extensions at all, you know that they start with the spec.json file. This defines the extension meta-data and more. Often in here you have properties such as "label" or "title". which are for user visible strings. For example:
"title": "Learn"
In this example I've used a hard-coded English string, so that's the text that all users will see. But instead I could code it like this:
"title": "%learn"
The magic here is the % symbol. This tells Cognos that this string is a key to be looked up in the locale file for the user's language.
In the extension zip file:
Now we just need to create the files where these strings get looked up. That's easy, just create a new folder in the extension called "locales", and then for each language you want to support, create a file called: {extensionName}_{locale}.properties
extensionName is what you have specified in the "name" property of your extension spec.json file.
locale is the language identifier, eg. "en", "fr", etc.
The file itself is a standard properties file of key:value pairs, one per line. eg. LearnExtension_en.properties for English:
learn=Learn
And if you want to support French, you'd also have LearnExtension_fr.properties:
learn=Apprendre
The locale file that gets used will be based on the users product locale setting in Cognos. It's as simple as that. Happy extending!