2 Replies Latest reply on Jul 19, 2015 11:02 PM by shipra

    i18n in apps: Works only partially

    sven.vetter

      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?