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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
erp5
Commits
9a7fadd9
Commit
9a7fadd9
authored
Jan 11, 2017
by
Boris Kocherov
Committed by
Boris Kocherov
Jan 12, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: add officejs_gadget_translation*
parent
7736771d
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1144 additions
and
0 deletions
+1144
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/officejs_gadget_translation_data_js.js
...em/web_page_module/officejs_gadget_translation_data_js.js
+11
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/officejs_gadget_translation_data_js.xml
...m/web_page_module/officejs_gadget_translation_data_js.xml
+326
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/officejs_gadget_translation_html.html
...tem/web_page_module/officejs_gadget_translation_html.html
+19
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/officejs_gadget_translation_html.xml
...Item/web_page_module/officejs_gadget_translation_html.xml
+327
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/officejs_gadget_translation_js.js
...ateItem/web_page_module/officejs_gadget_translation_js.js
+135
-0
bt5/erp5_officejs/PathTemplateItem/web_page_module/officejs_gadget_translation_js.xml
...teItem/web_page_module/officejs_gadget_translation_js.xml
+326
-0
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/officejs_gadget_translation_data_js.js
0 → 100644
View file @
9a7fadd9
/*globals window*/
/*jslint indent: 2, nomen: true, maxlen: 80*/
(
function
(
window
)
{
"
use strict
"
;
window
.
translation_data
=
{
en
:
{
}
};
}(
window
));
\ No newline at end of file
bt5/erp5_officejs/PathTemplateItem/web_page_module/officejs_gadget_translation_data_js.xml
0 → 100644
View file @
9a7fadd9
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/officejs_gadget_translation_html.html
0 → 100644
View file @
9a7fadd9
<!DOCTYPE html>
<html>
<head>
<meta
charset=
"utf-8"
/>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no"
/>
<title>
Translation Gadget
</title>
<!-- renderjs -->
<script
src=
"rsvp.js"
type=
"text/javascript"
></script>
<script
src=
"renderjs.js"
type=
"text/javascript"
></script>
<!-- custom script -->
<script
src=
"gadget_translation_data.js"
type=
"text/javascript"
></script>
<script
src=
"gadget_translation.js"
type=
"text/javascript"
></script>
</head>
<body>
</body>
</html>
bt5/erp5_officejs/PathTemplateItem/web_page_module/officejs_gadget_translation_html.xml
0 → 100644
View file @
9a7fadd9
This diff is collapsed.
Click to expand it.
bt5/erp5_officejs/PathTemplateItem/web_page_module/officejs_gadget_translation_js.js
0 → 100644
View file @
9a7fadd9
/*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_officejs/PathTemplateItem/web_page_module/officejs_gadget_translation_js.xml
0 → 100644
View file @
9a7fadd9
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