Added flexible template for i18n
authorAlexander Ebert <ebert@woltlab.com>
Tue, 3 Jan 2012 16:00:09 +0000 (17:00 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 3 Jan 2012 16:00:09 +0000 (17:00 +0100)
Credits go to @Gravatronics. Closes #318

wcfsetup/install/files/acp/templates/multipleLanguageInputJavascript.tpl [new file with mode: 0644]
wcfsetup/install/files/lib/system/language/I18nHandler.class.php

diff --git a/wcfsetup/install/files/acp/templates/multipleLanguageInputJavascript.tpl b/wcfsetup/install/files/acp/templates/multipleLanguageInputJavascript.tpl
new file mode 100644 (file)
index 0000000..2a4a32a
--- /dev/null
@@ -0,0 +1,10 @@
+{if !$forceSelection|isset}{assign var=forceSelection value=false}{/if}
+<script type="text/javascript">
+       //<![CDATA[
+       $(function() {
+               var $availableLanguages = { {implode from=$availableLanguages key=languageID item=languageName}{@$languageID}: '{$languageName}'{/implode} };
+               var $values = { {implode from=$i18nValues[$elementIdentifier] key=languageID item=value}'{@$languageID}': '{$value}'{/implode} };
+               new WCF.MultipleLanguageInput('{@$elementIdentifier}', {if $forceSelection}true{else}false{/if}, $values, $availableLanguages);
+       });
+       //]]>
+</script>
\ No newline at end of file
index 504b541891701ff2f230beba50eb8f3d69b6b8a0..77de9749160e9d69bb9f037ffb29d630049966f2 100644 (file)
@@ -124,7 +124,7 @@ class I18nHandler extends SingletonFactory {
         * @param       boolean         $requireI18n
         * @return      boolean
         */
-       public function validateValue($elementID, $requireI18n) {
+       public function validateValue($elementID, $requireI18n = false) {
                if ($this->isPlainValue($elementID)) {
                        if ($requireI18n || $this->getValue($elementID) == '') {
                                return false;