i18n: Improved support and switching between original and Latin script
| /trunk/application/layouts/index/multi-display.phtml |
|---|
| 537,35 → 537,62 |
| <li id="cmd4"><script type="text/javascript"> |
| var LANG_KLINGON = "<?php echo $klingon; ?>"; |
| var LANG_VULCAN = "<?php echo $vulcan; ?>"; |
| lcars.language = "<?php echo $language; ?>"; |
| </script> |
| <script type="text/javascript" |
| src="application/scripts/klingon.js" |
| <script type="text/javascript" |
| src="application/scripts/vulcan-media-script.js" |
| ></script> |
| <div class="button left right"<?php |
| if (in_array($language, array($klingon, $vulcan))) |
| <script type="text/javascript" src="application/scripts/klingon.js"></script> |
| <script type="text/javascript" src="application/scripts/vulcan-media-script.js"></script> |
| <script type="text/javascript"> |
| function toggleScript (button) |
| { |
| ?> tabindex="1" onclick="<?php |
| switch ($language) |
| var is_alien_language = (lcars.language == LANG_KLINGON |
| || lcars.language == LANG_VULCAN); |
| if (media_script_used) |
| { |
| case $klingon: echo 'pIqaD(this)'; break; |
| case $vulcan: echo 'if (media_script_used) { latinScript(this); } else { mediaScript(this); }'; break; |
| klingonLatinScript(button); |
| latinScript(button); |
| if (!is_alien_language) |
| { |
| button.firstChild.textContent = button.getAttribute("data-caption"); |
| } |
| } |
| ?>"<?php |
| else |
| { |
| pIqaD(button); |
| mediaScript(button); |
| if (!is_alien_language) |
| { |
| button.setAttribute("data-caption", button.firstChild.textContent); |
| button.firstChild.textContent = "Latin"; |
| } |
| } |
| } |
| </script> |
| <div class="button left right"<?php |
| $language_keys = array_keys($languages); |
| if (in_array(@$klingon, $language_keys) || in_array(@$vulcan, $language_keys)) |
| { |
| ?> tabindex="1" onclick="return toggleScript(this)"<?php |
| } |
| else |
| { |
| ?> style="cursor: not-allowed !important"<?php |
| } |
| ?>><span class="text"><?php |
| echo $language == $vulcan ? 'Hitra-Zukitan' : ' '; |
| ?>><span class="text" lang="<?php echo $language; ?>"><?php |
| switch ($language) |
| { |
| case $klingon: echo 'pIqaD'; break; |
| case $vulcan: echo 'Hitra-Zukitan'; break; |
| default: echo 'Original'; |
| } |
| ?></span> |
| </div></li> |
| </ul> |
| </div> |
| <div class="elbo-button"> |
| <span class="text" |
| <span class="text" lang="<?php echo $language; ?>" |
| title="<?php echo tr("Date of last modification"); ?>" |
| ><?php echo gmdate('Ym.d', $modi); ?></span> |
| </div> |
| /trunk/application/layouts/index/index.phtml |
|---|
| 158,7 → 158,7 |
| content: lcars.content |
| }); |
| /* Enable Vulcan Media Script */ |
| /* Enable Klingon pIQaD/Vulcan Media Script */ |
| var cmd4 = document.getElementById("cmd4"); |
| if (cmd4 && cmd4.lastChild && typeof cmd4.lastChild.onclick == "function") |
| { |
| /trunk/application/scripts/vulcan-media-script.js |
|---|
| 65,14 → 65,13 |
| // return flipped; |
| //}; |
| var media_caption; |
| var media_script_used = false; |
| function mediaScript (button) |
| { |
| vulcan_texts = jsx.dom.xpath.evaluate( |
| './/*[@lang = "' + LANG_VULCAN + '"]//*[(not(@lang) or (@lang = "' + LANG_VULCAN + '")) and (@class = "text")]', |
| './/*[@class = "text" and (@lang = "' + LANG_VULCAN |
| + '" or parent::*[@lang = "' + LANG_VULCAN + '"])]', |
| document.body); |
| if (!vulcan_texts) |
| 80,8 → 79,6 |
| return; |
| } |
| var previous_parent = null; |
| for (var i = 0, len = vulcan_texts.length; i < len; ++i) |
| { |
| var text = vulcan_texts[i]; |
| 105,22 → 102,19 |
| { |
| var text_node = text_nodes[j]; |
| if (text_node.parentNode.lang != LANG_VULCAN) |
| { |
| text_node.nodeValue = text_node.nodeValue.replace( |
| rxVulcan, |
| function (s) { |
| return jsx.object.getProperty(media_map, s.replace(/\s+/g, " ").toUpperCase(), s); |
| }); |
| } |
| text_node.nodeValue = text_node.nodeValue.replace( |
| rxVulcan, |
| function (s) { |
| return jsx.object.getProperty(media_map, s.replace(/\s+/g, " ").toUpperCase(), s); |
| }); |
| } |
| text.parentNode.lang = "vuh-Media-Gol-modern"; |
| } |
| if (button) |
| if (button && lcars.language == LANG_VULCAN) |
| { |
| media_caption = button.firstChild.textContent; |
| button.setAttribute("data-caption", button.firstChild.textContent); |
| button.firstChild.textContent = "Latin-Zukitan"; |
| } |
| 138,7 → 132,10 |
| text.parentNode.lang = "vuh-Latn-Gol-modern"; |
| } |
| button.firstChild.textContent = media_caption; |
| if (lcars.language == LANG_VULCAN) |
| { |
| button.firstChild.textContent = button.getAttribute("data-caption"); |
| } |
| media_script_used = false; |
| } |
| /trunk/application/scripts/klingon.js |
|---|
| 73,9 → 73,8 |
| function pIqaD (button) |
| { |
| klingon_texts = jsx.dom.xpath.evaluate( |
| './/*[@lang = "' + LANG_KLINGON + '"]' |
| + '//*[(not(@lang) or (@lang = "' + LANG_KLINGON + '"))' |
| + ' and (@class = "text")]', |
| './/*[@class = "text" and (@lang = "' + LANG_KLINGON |
| + '" or parent::*[@lang = "' + LANG_KLINGON + '"])]', |
| document.body); |
| if (!klingon_texts) |
| 89,7 → 88,7 |
| { |
| var text = klingon_texts[i]; |
| text.style.fontFamily = "'pIqaD', 'Constructium', 'Code2000'"; |
| text.style.fontFamily = "pIqaD, Constructium, Code2000, serif"; |
| text.style.fontSize = "90%"; |
| if (!text.hasAttribute("data-html")) |
| 110,23 → 109,22 |
| { |
| var text_node = text_nodes[j]; |
| if (text_node.parentNode.lang != LANG_KLINGON) |
| { |
| text_node.nodeValue = text_node.nodeValue.toUpperCase().replace( |
| rxKlingon, |
| function (s) { |
| return jsx.object.getProperty(klingon_map, s.replace(/\s+/g, " "), s); |
| }); |
| } |
| text_node.nodeValue = text_node.nodeValue.toUpperCase().replace( |
| rxKlingon, |
| function (s) { |
| return jsx.object.getProperty(klingon_map, s.replace(/\s+/g, " "), s); |
| }); |
| } |
| text.parentNode.lang = "tlh-pIqaD"; |
| } |
| if (button) |
| if (button && lcars.language == LANG_KLINGON) |
| { |
| media_caption = button.firstChild.textContent; |
| button.setAttribute("data-caption", button.firstChild.textContent); |
| button.firstChild.textContent = "Latin"; |
| button.firstChild.style.fontFamily = ""; |
| button.firstChild.style.fontSize = ""; |
| } |
| } |
| 142,5 → 140,8 |
| text.parentNode.lang = "tlh-Latn"; |
| } |
| button.firstChild.textContent = media_caption; |
| if (lcars.language == LANG_KLINGON) |
| { |
| button.firstChild.textContent = button.getAttribute("data-caption"); |
| } |
| } |