Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Cédric Le Ninivin
erp5
Commits
9d0b0878
Commit
9d0b0878
authored
Jul 03, 2018
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_web_renderjs_ui] Translate: add getTranslationList method
parent
e61e0c87
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
33 deletions
+46
-33
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.js
...mplateItem/web_page_module/rjs_gadget_erp5_launcher_js.js
+5
-0
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.xml
...plateItem/web_page_module/rjs_gadget_erp5_launcher_js.xml
+2
-2
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_translation_js.js
...TemplateItem/web_page_module/rjs_gadget_translation_js.js
+37
-29
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_translation_js.xml
...emplateItem/web_page_module/rjs_gadget_translation_js.xml
+2
-2
No files found.
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.js
View file @
9d0b0878
...
...
@@ -410,6 +410,11 @@
.
allowPublicAcquisition
(
"
translate
"
,
function
translate
(
argument_list
)
{
return
route
(
this
,
'
translation_gadget
'
,
'
translate
'
,
argument_list
);
})
.
allowPublicAcquisition
(
"
getTranslationList
"
,
function
getTranslationList
(
argument_list
)
{
return
route
(
this
,
'
translation_gadget
'
,
'
getTranslationList
'
,
argument_list
);
})
.
allowPublicAcquisition
(
"
redirect
"
,
function
redirect
(
param_list
)
{
return
route
(
this
,
'
router
'
,
'
redirect
'
,
param_list
);
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_erp5_launcher_js.xml
View file @
9d0b0878
...
...
@@ -230,7 +230,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
968.42891.
16664.21862
</string>
</value>
<value>
<string>
968.42891.
50280.153
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -248,7 +248,7 @@
</tuple>
<state>
<tuple>
<float>
1530622
785.99
</float>
<float>
1530622
831.54
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_translation_js.js
View file @
9d0b0878
/*global document, window, rJS, translation_data
, RSVP
*/
/*global document, window, rJS, translation_data */
/*jslint nomen: true, indent: 2 */
(
function
(
document
,
window
,
rJS
,
translation_data
,
RSVP
)
{
(
function
(
document
,
window
,
rJS
,
translation_data
)
{
"
use strict
"
;
function
translate
(
string
,
gadget
)
{
...
...
@@ -93,43 +93,51 @@
return
temp
.
innerHTML
;
}
function
translateList
(
gadget
,
string_list
,
only_first
)
{
var
i
,
result_list
=
[];
for
(
i
=
0
;
i
<
string_list
.
length
;
i
+=
1
)
{
result_list
.
push
(
translate
(
string_list
[
i
],
gadget
));
}
if
(
only_first
)
{
return
result_list
[
0
];
}
return
result_list
;
}
function
promiseTranslateList
(
gadget
,
string_list
,
only_first
)
{
// XXX Allow to change the language
if
(
!
gadget
.
state
.
language
)
{
return
gadget
.
getSettingList
([
"
selected_language
"
,
"
default_selected_language
"
])
.
push
(
function
(
result_list
)
{
gadget
.
state
.
language
=
result_list
[
0
]
||
result_list
[
1
];
return
translateList
(
gadget
,
string_list
,
only_first
);
});
}
return
translateList
(
gadget
,
string_list
,
only_first
);
}
rJS
(
window
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
declareAcquiredMethod
(
"
getSettingList
"
,
"
getSettingList
"
)
.
declareMethod
(
'
getTranslationList
'
,
function
(
string_list
)
{
return
promiseTranslateList
(
this
,
string_list
);
})
.
declareMethod
(
'
translate
'
,
function
(
string
)
{
// XXX Allow to change the language
var
gadget
=
this
;
if
(
!
gadget
.
state
.
language
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getSetting
(
"
selected_language
"
),
gadget
.
getSetting
(
"
default_selected_language
"
)
]);
})
.
push
(
function
(
results
)
{
gadget
.
state
.
language
=
results
[
0
]
||
results
[
1
];
return
translate
(
string
,
gadget
);
});
}
return
translate
(
string
,
gadget
);
return
promiseTranslateList
(
this
,
[
string
],
true
);
})
.
declareMethod
(
'
translateHtml
'
,
function
(
string
)
{
var
gadget
=
this
;
if
(
!
gadget
.
state
.
language
)
{
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
RSVP
.
all
([
gadget
.
getSetting
(
"
selected_language
"
),
gadget
.
getSetting
(
"
default_selected_language
"
)
]);
})
.
push
(
function
(
results
)
{
gadget
.
state
.
language
=
results
[
0
]
||
results
[
1
];
return
gadget
.
getSettingList
([
"
selected_language
"
,
"
default_selected_language
"
])
.
push
(
function
(
result_list
)
{
gadget
.
state
.
language
=
result_list
[
0
]
||
result_list
[
1
];
return
translateHtml
(
string
,
gadget
);
});
}
return
translateHtml
(
string
,
gadget
);
});
}(
document
,
window
,
rJS
,
translation_data
,
RSVP
));
}(
document
,
window
,
rJS
,
translation_data
));
bt5/erp5_web_renderjs_ui/PathTemplateItem/web_page_module/rjs_gadget_translation_js.xml
View file @
9d0b0878
...
...
@@ -234,7 +234,7 @@
</item>
<item>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
55.20795.60990.42035
</string>
</value>
<value>
<string>
9
68.42890.13273.63180
</string>
</value>
</item>
<item>
<key>
<string>
state
</string>
</key>
...
...
@@ -252,7 +252,7 @@
</tuple>
<state>
<tuple>
<float>
1
479833218.18
</float>
<float>
1
530622707.63
</float>
<string>
UTC
</string>
</tuple>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment