Enable translations for paragraphs containing links.
Signed-off-by: Gökay Şatır <gokaysatir@collabora.com> Change-Id: I9b66f7b301487cf345c9a136943a6148827a2d49
This commit is contained in:
parent
31130d50ea
commit
7410e2ff85
2 changed files with 22 additions and 22 deletions
|
@ -23,33 +23,33 @@
|
|||
<fig id="fig-slide1-c"></fig>
|
||||
<fig id="fig-slide1-r"></fig>
|
||||
</fig>
|
||||
<h1 id="welcome-slide1-heading-1">Explore The New %coolVersion</h1>
|
||||
<h2 id="welcome-slide1-heading-2">Collabora Online Development Edition</h2>
|
||||
<p id="welcome-slide1-content">Enjoy the latest developments in online productivity, free for you to use, to explore and to use with others in the browser. Various <a target="_blank" href="https://www.collaboraoffice.com/solutions/collabora-office-android-ios/">apps</a> are also available for mobile.</p>
|
||||
<h1 id="welcome-slide1-heading-1" data-translate="true">Explore The New %coolVersion</h1>
|
||||
<h2 id="welcome-slide1-heading-2" data-translate="true">Collabora Online Development Edition</h2>
|
||||
<p id="welcome-slide1-content" data-translate="true">Enjoy the latest developments in online productivity, free for you to use, to explore and to use with others in the browser. Various <a target="_blank" href="https://www.collaboraoffice.com/solutions/collabora-office-android-ios/">apps</a> are also available for mobile.</p>
|
||||
<div id="user-welcome--buttons">
|
||||
<form action="#slide-2">
|
||||
<button type="button" id="slide-1-button">Next</button>
|
||||
<button type="button" id="slide-1-button" data-translate="true">Next</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="slide-2">
|
||||
<fig></fig>
|
||||
<h1 id="welcome-slide2-heading-1">Discover All The Changes</h1>
|
||||
<h2 id="welcome-slide2-heading-2">Collabora Online Development Edition</h2>
|
||||
<p id="welcome-slide2-content">Check the <a target="_blank" href="https://www.collaboraoffice.com/code-21-11-release-notes/">release notes</a> and learn all about: The latest Collabora Online Development Edition, aimed at home users and small teams. </p>
|
||||
<h1 id="welcome-slide2-heading-1" data-translate="true">Discover All The Changes</h1>
|
||||
<h2 id="welcome-slide2-heading-2" data-translate="true">Collabora Online Development Edition</h2>
|
||||
<p id="welcome-slide2-content" data-translate="true">Check the <a target="_blank" href="https://www.collaboraoffice.com/code-21-11-release-notes/">release notes</a> and learn all about: The latest Collabora Online Development Edition, aimed at home users and small teams. </p>
|
||||
<div id="user-welcome--buttons">
|
||||
<form action="#slide-3">
|
||||
<button type="button" id="slide-2-button">Next</button>
|
||||
<button type="button" id="slide-2-button" data-translate="true">Next</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="slide-3">
|
||||
<fig></fig>
|
||||
<h1 id="welcome-slide3-heading-1">Get Involved</h1>
|
||||
<h2 id="welcome-slide3-heading-2"><a target="_blank" href="https://collaboraonline.github.io/">https://collaboraonline.github.io/</a></h2>
|
||||
<p id="welcome-slide3-content">Are you interested in contributing but don’t know where to start? Head over to the <a target="_blank" href="https://collaboraonline.github.io/post/build-code/">step-by-step instructions</a> and build CODE from scratch. You can also help out with <a target="_blank" href="https://collaboraonline.github.io/post/translate/">translations</a> or by <a target="_blank" href="https://collaboraonline.github.io/post/filebugs/">filing a bug report</a> with all the essential steps on how to reproduce it. </p>
|
||||
<h1 id="welcome-slide3-heading-1" data-translate="true">Get Involved</h1>
|
||||
<h2 id="welcome-slide3-heading-2" data-translate="true"><a target="_blank" href="https://collaboraonline.github.io/">https://collaboraonline.github.io/</a></h2>
|
||||
<p id="welcome-slide3-content" data-translate="true">Are you interested in contributing but don’t know where to start? Head over to the <a target="_blank" href="https://collaboraonline.github.io/post/build-code/">step-by-step instructions</a> and build CODE from scratch. You can also help out with <a target="_blank" href="https://collaboraonline.github.io/post/translate/">translations</a> or by <a target="_blank" href="https://collaboraonline.github.io/post/filebugs/">filing a bug report</a> with all the essential steps on how to reproduce it. </p>
|
||||
<div id="user-welcome--buttons">
|
||||
<button type="button" id="slide-3-button">Close</button>
|
||||
<button type="button" id="slide-3-button" data-translate="true">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -65,21 +65,21 @@ function onMessage(e) {
|
|||
}
|
||||
|
||||
function getTranslatable(root, strings) {
|
||||
var nodes = root.childNodes;
|
||||
for (var it = 0; it < nodes.length; ++it) {
|
||||
if (nodes[it].nodeType == Node.TEXT_NODE) {
|
||||
strings[nodes[it].nodeValue] = '';
|
||||
var children = root.children;
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
if (children[i].dataset.translate === 'true') {
|
||||
strings[children[i].innerHTML.trim().replace('\n', '')] = '';
|
||||
}
|
||||
getTranslatable(nodes[it], strings);
|
||||
getTranslatable(children[i], strings);
|
||||
}
|
||||
}
|
||||
|
||||
function setTranslatable(root, strings) {
|
||||
var nodes = root.childNodes;
|
||||
for (var it = 0; it < nodes.length; ++it) {
|
||||
if (nodes[it].nodeType == Node.TEXT_NODE) {
|
||||
nodes[it].nodeValue = strings[nodes[it].nodeValue];
|
||||
var children = root.children;
|
||||
for (var i = 0; i < children.length; ++i) {
|
||||
if (children[i].dataset.translate === 'true') {
|
||||
children[i].innerHTML = strings[children[i].innerHTML.trim().replace('\n', '')];
|
||||
}
|
||||
setTranslatable(nodes[it], strings);
|
||||
setTranslatable(children[i], strings);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue