Mar
22

Using localized resources from Service Manager in custom applications

By

When developing extensions to Service Manager you want to be able to use the localization support of Service Manager. The strategy chosen by the product team of Service Manager is to store localized content primarily in management packs. When you’re creating new management packs you define the ”strings” that should be displayed in the Service Manager console depending on which language the console is currently running under. You do this in the LanguagePacks section of your management packs as shown in the picture below.

LanguagePacks

As you see in the picture you can define different language packs. Within these you add references to elements of your management packs. For instance you can specify what should be the displayed name of a list item defined in the management pack. You could specify different names for English, Swedish and all other languages that could be used by your Service Manager interacting users.

To be able to use these localized values in custom forms within the Service Manager console you do this by using data binding as explained in this post by Travis Wright. Now if you’re creating an application outside the console that needs to display data from Service Manager (using the SDK) you want to be able to reuse the localization made in Service Manager. Let’s say that you want to display, as it was in my case, a localized list. To retrieve the localized values from Service Manager you use an object called ManagementPackDisplayString. You simply retrieve a ManagementPackDisplayString from the element you want to get a localized value from using a specified CultureInfo. In the picture below I’m retrieving the localized name of a list.

DisplayString

As you see you’re also able to get a localized description of the object. The “CurrentCulture” as seen in the picture is the culture your application is currently running under. For more information regarding CultureInfo start here.

Important, you need to make sure that there is a localization of an element in the specified language before you try to retrive it. If you try to retrive a localized value in a culture that doesn’t exist as a LanguagePack the “GetDisplayString” method will throw an exception.

Comments

  1. [...] Using localized resources from Service Manager in custom applications [...]

  2. [...] Using localized resources from Service Manager in custom applications [...]

  3. [...] Using localized resources from Service Manager in custom applications [...]

Leave a Reply