cancel
Showing results for 
Search instead for 
Did you mean: 

Localization for webpages build using SAP UI5 in SAP MII.

Former Member
0 Kudos

I have build a web application using SAP UI5 as fontend in SAP MII.I want to implement the localization for my web application  the way it is implemented in SAP MII.

I know, localization can be using SAPUI5, create i18n.properties files for different languages. But, SAP MII localization usage provide benifits that a non technical person can be giving access and he can create/change the key values pairs.

I tried a lot to implement using SAP MII methods, but all failed.

Thanks,

Shashi

Accepted Solutions (0)

Answers (2)

Answers (2)

swaroop_anasane
Active Contributor
0 Kudos

Hi Sashi,

I second Sam on this. {} placeholder works in htm code not inside script tag.

This is similar to passing a parameter in servlets using param function. Something as:

<Param name="Param.1" value={propertyName}>

Alternately, if you use applets or servlets, we do have some methods to get the property values directly in scripts as well. Simple examples as mentioned below:

<Applet name="App1" class=ClassName viewastext mayscript>

</Applet>

You can here use, App1.setProperty("abc") and App1.getProperty("abc") for play with properties.

Hope this helps.

Thanks,

Swaroop

0 Kudos

On your page, if you use the extension .irpt, you can use the syntax of {##LocalizationKey} in the HTML which will return the localized value for your logged in user.  Details are outlined here in the help documentation:

SAP Library - MII Visualization Services

Hope this helps,

Sam

Former Member
0 Kudos

In normal MII, using below mentioned code works,

<h1>{##Header}</h1>

<input type="button" value={##BTN_Click} onclick="load()">

But, in SAP UI5(code below), using ## Key notation, it generates a error:

var header = new sap.ui.commons.TextView({text: {##Header} });

header.placeAt("Content");

Both the above pages are .irpt pages.

If I'm doing something wrong. please correct me.

0 Kudos

In the HTML body the localization syntax will work as you mentioned but it will not work in the "Script" section of your page.  For this you have to set the localization value in a hidden text field on the page in the body of your HTML and then reference this field via the JS.

I agree there should be a localization function for the i5 objects, please report this feature request via a CSN ticket.  Please reference this thread in the ticket.

Hope this helps,

Sam

On a related side note, if you use JSP you can use the following on your web page to call the localization method directly; here's a page snippet:

<%@ page language="java" %>

<%@ taglib uri="/tlt" prefix="tlt" %>

<html>

<head>

  <title>

   Localization Using JSP

  </title>

</head>

<body>

  <h2>Demo Localization JSP</h2>

  Hi <tlt:localize key="Name"/>, <tlt:localize key="Greeting"/> !!

  <br>

  <tlt:localize key="Language"/>

</body>

</html>