Commit 293687c5 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_renderjs_ui: add getTranslationDict acquired method

```
return gadget.getTranslationDict([Foo])
  .push(function (translation_dict) {
    console.log(translation_dict['Foo'])
  });
```
parent 80e5334a
...@@ -561,6 +561,11 @@ ...@@ -561,6 +561,11 @@
return route(this, 'translation_gadget', 'getTranslationList', return route(this, 'translation_gadget', 'getTranslationList',
argument_list); argument_list);
}) })
.allowPublicAcquisition("getTranslationDict",
function getTranslationDict(argument_list) {
return route(this, 'translation_gadget', 'getTranslationDict',
argument_list);
})
.allowPublicAcquisition("getSelectedLanguage", .allowPublicAcquisition("getSelectedLanguage",
function getSelectedLanguage() { function getSelectedLanguage() {
return route(this, 'translation_gadget', 'getSelectedLanguage'); return route(this, 'translation_gadget', 'getSelectedLanguage');
......
...@@ -234,7 +234,7 @@ ...@@ -234,7 +234,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>989.27523.29749.43383</string> </value> <value> <string>989.53405.52051.4676</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -252,7 +252,7 @@ ...@@ -252,7 +252,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1612532987.6</float> <float>1612535723.63</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -135,6 +135,17 @@ ...@@ -135,6 +135,17 @@
.declareMethod('getTranslationList', function (string_list) { .declareMethod('getTranslationList', function (string_list) {
return promiseTranslateList(this, string_list); return promiseTranslateList(this, string_list);
}) })
.declareMethod('getTranslationDict', function (string_list) {
return new RSVP.Queue(promiseTranslateList(this, string_list))
.push(function (translation_list) {
var i,
translation_dict = {};
for (i = 0; i < string_list.length; i += 1) {
translation_dict[string_list[i]] = translation_list[i];
}
return translation_dict;
});
})
.declareMethod('translate', function (string) { .declareMethod('translate', function (string) {
return promiseTranslateList(this, [string], true); return promiseTranslateList(this, [string], true);
}) })
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>981.1053.43706.60842</string> </value> <value> <string>989.53448.60706.11025</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1578453690.65</float> <float>1612535587.53</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -29,6 +29,13 @@ ...@@ -29,6 +29,13 @@
<dd></dd> <dd></dd>
</dl> </dl>
<dt>getTranslationDict</dt>
<dd>Translate a list of text and return a dict</dd>
<dl>
<dt data-parameter-required="required">text_list</dt>
<dd></dd>
</dl>
<dt>translateHtml</dt> <dt>translateHtml</dt>
<dd>Translate a HTML text</dd> <dd>Translate a HTML text</dd>
<dl> <dl>
......
...@@ -238,7 +238,7 @@ ...@@ -238,7 +238,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>980.55319.6399.26880</string> </value> <value> <string>989.53450.23383.52189</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -256,7 +256,7 @@ ...@@ -256,7 +256,7 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1578361034.9</float> <float>1612535670.7</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment