AnsweredAssumed Answered

i18n in apps: Works only partially

Question asked by sven.vetter on May 9, 2013
Latest reply on Jul 19, 2015 by shipra

Hello

 

I try to translate my first app (Jive 6.0.2). This works - but only in the app.xml.

 

Example:

<?xml version="1.0" encoding="UTF-8"?>
<Module specificationVersion="1">
  <ModulePrefs title="in18 Test">
    <Locale messages="languages/ALL_ALL.xml"/> 
    <Locale lang="de" messages="languages/de_ALL.xml"/>
    
  </ModulePrefs>
  <Content type="html" view="canvas">
    <![CDATA[
    HTML: __MSG_my.title__ <br />
    <script>
      var prefs = new gadgets.Prefs();
      document.write("JavaScript 1: " + prefs.getMsg("my.title"));
      document.write("<br />JavaScript 2: __MSG_my.title__");
    </script>
      ]]>
    </Content>
</Module>

 

Output:

HTML: My title

JavaScript 1: My title

JavaScript 2: My title

Fine

 

But If I move the content in a html file only the first JavaScript command works.

 

Example:

app.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Module specificationVersion="1">
  <ModulePrefs title="in18 Test">
    <Locale messages="languages/ALL_ALL.xml"/> 
    <Locale lang="de" messages="languages/de_ALL.xml"/>
  </ModulePrefs>
  <Content type="html" view="canvas" href="overview.html" preferred_height="800"/>
</Module>

 

overview.html:

HTML: __MSG_my.title__ <br />
<script>
  var prefs = new gadgets.Prefs();
  document.write("JavaScript 1: " + prefs.getMsg("my.title"));
  document.write("<br />JavaScript 2: __MSG_my.title__");
</script>

 

Output:

HTML: __MSG_my.title__

JavaScript 1: My title

JavaScript 2: __MSG_my.title__

No translation, only with getMsg

 

Any idea?

Outcomes