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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Boxiang Sun
erp5
Commits
fb34d748
Commit
fb34d748
authored
Sep 09, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_travel_expense: use translation gadget provide by officejs
parent
20258fd6
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
3 additions
and
474 deletions
+3
-474
bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_translation_html.html
...plateItem/web_page_module/gadget_hr_translation_html.html
+1
-1
bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_translation_html.xml
...mplateItem/web_page_module/gadget_hr_translation_html.xml
+2
-2
bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_translation_js.js
...hTemplateItem/web_page_module/gadget_hr_translation_js.js
+0
-135
bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_translation_js.xml
...TemplateItem/web_page_module/gadget_hr_translation_js.xml
+0
-336
No files found.
bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_translation_html.html
View file @
fb34d748
...
@@ -49,7 +49,7 @@
...
@@ -49,7 +49,7 @@
<!-- custom script -->
<!-- custom script -->
<script
src=
"gadget_hr_translation_data.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_hr_translation_data.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_
hr_
translation.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_translation.js"
type=
"text/javascript"
></script>
</head>
</head>
<body>
<body>
...
...
bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_translation_html.xml
View file @
fb34d748
...
@@ -244,7 +244,7 @@
...
@@ -244,7 +244,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
9
57.10717.51315.25070
</string>
</value>
<value>
<string>
9
94.42603.26741.38963
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -262,7 +262,7 @@
...
@@ -262,7 +262,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1
486476623.77
</float>
<float>
1
631191673.79
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_translation_js.js
deleted
100644 → 0
View file @
20258fd6
/*global document, window, rJS, translation_data, RSVP */
/*jslint nomen: true, indent: 2 */
(
function
(
document
,
window
,
rJS
,
translation_data
,
RSVP
)
{
"
use strict
"
;
function
translate
(
string
,
gadget
)
{
if
(
translation_data
[
gadget
.
state
.
language
])
{
return
translation_data
[
gadget
.
state
.
language
][
string
]
||
string
;
}
return
string
;
}
// translate a list of elements passed and returned as string
function
translateHtml
(
string
,
gadget
)
{
var
temp
,
element_list
,
i
,
i_len
,
element
,
lookup
,
translate_list
,
target
,
route_text
,
has_breaks
,
l
,
l_len
,
j
,
j_len
;
// NOTE: <div> cannot be used for everything... (like table rows)
// XXX: currently I only update where needed. Eventually all calls to
// translateHtml should pass "their" proper wrapping element
temp
=
document
.
createElement
(
"
div
"
);
temp
.
innerHTML
=
string
;
element_list
=
temp
.
querySelectorAll
(
"
[data-i18n]
"
);
for
(
i
=
0
,
i_len
=
element_list
.
length
;
i
<
i_len
;
i
+=
1
)
{
element
=
element_list
[
i
];
lookup
=
element
.
getAttribute
(
"
data-i18n
"
);
if
(
lookup
)
{
translate_list
=
lookup
.
split
(
"
;
"
);
for
(
l
=
0
,
l_len
=
translate_list
.
length
;
l
<
l_len
;
l
+=
1
)
{
target
=
translate_list
[
l
].
split
(
"
]
"
);
switch
(
target
[
0
])
{
case
"
[placeholder
"
:
case
"
[alt
"
:
case
"
[title
"
:
element
.
setAttribute
(
target
[
0
].
substr
(
1
),
translate
(
target
[
1
],
gadget
));
break
;
case
"
[value
"
:
has_breaks
=
element
.
previousSibling
.
textContent
.
match
(
/
\n
/g
);
// JQM inputs > this avoids calling checkboxRadio("refresh")!
if
(
element
.
tagName
===
"
INPUT
"
)
{
switch
(
element
.
type
)
{
case
"
submit
"
:
case
"
reset
"
:
case
"
button
"
:
route_text
=
true
;
break
;
}
}
if
(
route_text
&&
(
has_breaks
||
[]).
length
===
0
)
{
element
.
previousSibling
.
textContent
=
translate
(
target
[
1
],
gadget
);
}
element
.
value
=
translate
(
target
[
1
],
gadget
);
break
;
case
"
[parent
"
:
element
.
parentNode
.
childNodes
[
0
].
textContent
=
translate
(
target
[
1
],
gadget
);
break
;
case
"
[node
"
:
element
.
childNodes
[
0
].
textContent
=
translate
(
target
[
1
],
gadget
);
break
;
case
"
[last
"
:
// if null, append, if textnode replace, if span, appned
if
(
element
.
lastChild
&&
element
.
lastChild
.
nodeType
===
3
)
{
element
.
lastChild
.
textContent
=
translate
(
target
[
1
],
gadget
);
}
else
{
element
.
appendChild
(
document
.
createTextNode
(
translate
(
target
[
1
],
gadget
)));
}
break
;
case
"
[html
"
:
element
.
innerHTML
=
translate
(
target
[
1
],
gadget
);
break
;
default
:
if
(
element
.
hasChildNodes
())
{
for
(
j
=
0
,
j_len
=
element
.
childNodes
.
length
;
j
<
j_len
;
j
+=
1
)
{
if
(
element
.
childNodes
[
j
].
nodeType
===
3
)
{
element
.
childNodes
[
j
].
textContent
=
translate
(
translate_list
[
l
],
gadget
);
}
}
}
else
{
element
.
textContent
=
translate
(
translate_list
[
l
],
gadget
);
}
break
;
}
}
}
}
// return string
return
temp
.
innerHTML
;
}
rJS
(
window
)
.
declareAcquiredMethod
(
"
getSetting
"
,
"
getSetting
"
)
.
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
);
})
.
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
translateHtml
(
string
,
gadget
);
});
}
return
translateHtml
(
string
,
gadget
);
});
}(
document
,
window
,
rJS
,
translation_data
,
RSVP
));
bt5/erp5_travel_expense/PathTemplateItem/web_page_module/gadget_hr_translation_js.xml
deleted
100644 → 0
View file @
20258fd6
This diff is collapsed.
Click to expand it.
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