Skip to Content
avatar image
Former Member

Dynamic Internationalization / Localization

Hello!

We have MII work centers on the manufacturing floor that run under "dummy" accounts (ex: workcenter1 login). That login is set to use a language setting of "es" (Spanish). We have many different users throughout the day who clock in and out of the MII application, but the single dummy account is who is actually logged in. Meaning: each workcenter user does not login / logout throughout the day. The application stays running under the dummy account.

I have a requirement to allow users to change the language setting within the application as they see the need. In the example above - the default setting is Spanish, but maybe that particular user is more comfortable reading English. They need to be able to, on the fly, set the new language and have the page render correctly.

I have defined 2 bundle files: MII_en.properties and MII_es.properties and placed a few label names inside each. If I change the dummy user's language preference in their account and log out and log back in under that dummy account, the new language takes affect as I'd expect. The labels are read from the correct bundle file.

However, if I try to programmatically, within the MII application, set the session variables for Language, Country, locale and Locale - it has absolutely no effect on the page or resource bundle that's chosen! I always see the labels as they were when the user logged in.

In "normal", non MII, web development (think: Java/Spring/JSP stack), I can create a dropdown list for the user to choose their session language dynamically and refresh the page. The correct resource bundle gets picked up and the language renders correctly. I don't need the user to log out and log back in.

Is this same functionality not available in MII? Am I required to have the user log out and log back in?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Jan 19, 2016 at 06:45 PM

    You may also be able to append the following parameter to the page URL in order to force it to be overridden when loaded:

    &Language=es

    Sam

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Sam,

      Apologies for confusion, what i was talking was no where related to MII standard implementations.

      It was about using resourceModel in UI5 where in you can identify user's locale and tell UI5 to create resouce model as per user's locale or locale selected from dropdown.

      Anyways parallel method is already implemented by Brian.


      Thanks,
      Swaroop

  • Jan 19, 2016 at 06:35 PM

    Hello everyone,

    The localization for MII web pages developed as content support international languages (all of them supported by Java) and the MII Admin pages (Web Dynpro based Menu items) support a subset of languages and this list is outlined in the SAP Product Availability Matrix (http://support.sap.com/pam). 

    In the MII Workbench in the Meta-Inf tab for each project you will see the following path:

    <Project Name> -> META-INF -> Bundles

    If you right click on the "Bundles" folder you will be able to "Create a New Resource" where you can pick the language you would like to create a properties bundle for.  In this case for Spanish you can define the Key and Value pairs for localization.  In order for localization to work on your pages you have to end all of your web pages with the .irpt extension instead of using .html as the extension.  This tells the MII parser to traverse the HTML page prior to sending it to the client and it will replace all of the various keys on the page accordingly.  This is outlined in the MII help documentation here:

    Project Localization - SAP Manufacturing Integration and Intelligence - SAP Library

    In the login definition for your user you will also see a set of properties that MII uses to manage the session, including a "Language" property that comes from the NetWeaver UME language setting for your user.  To view all properties for a Role/User use this URL:

    http://<ServerName:PortNumber>/XMII/PropertyAccessServlet?Mode=List

    This language property field can be set using the MII JavaScript functions to whatever value you like and this will therefore override the localization of the page will be done based on the defined language of the session.  All of the UI5 and applet objects have this JavaScript function and this is what is used to manipulate and create session properties:

    i5Grid.setPropertyValue(propertyName, propertyValue)

    Sam

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Ok, so I already had everything done according to your note above:

      • All of my pages have an extension of .irpt
      • I had two bundles set up (one for English (en), one for Spanish(es))
      • The user's "default" language was set to "en" (English) and I was seeing all of the pages in the correct language

      However, I'm still stuck on being able to change the language dynamically.

      If I append &Language=es to the URL, it does change the session value so that the "Language=es", but it does *not* pick up any values from my bundle. The English labels, button texts, etc are still visible - nothing related to my Spanish resource bundle shows on the screen - even after refreshing the screen.

      Also, I'm not sure I understand what you're saying about setting a field using the MII JavaScript functions. The project I'm working on doesn't seem to have the SAPUI5 SDK installed or added. Are there non-UI5 functions I can call to set the language?

      This language property field can be set using the MII JavaScript functions to whatever value you like and this will therefore override the localization of the page will be done based on the defined language of the session.  All of the UI5 and applet objects have this JavaScript function and this is what is used to manipulate and create session properties:

      i5Grid.setPropertyValue(propertyName, propertyValue)

  • avatar image
    Former Member
    Jan 13, 2016 at 03:06 PM

    BUMP...anyone?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 19, 2016 at 05:45 PM

    BUMP again...has no one done Internationalization/Localization in MII?

    Add comment
    10|10000 characters needed characters exceeded