From 689960aa647f0e6d9aea8ef2b8d065651166bcf6 Mon Sep 17 00:00:00 2001 From: Matthias Schmidt Date: Tue, 19 Aug 2014 18:52:23 +0200 Subject: [PATCH] Add __literal parameter for lang template plugin {lang __literal=true}wcf.foo.bar{/lang} won't parse the value of the wcf.foo.bar so that the variables are preserved to be parsed by JavaScript. --- com.woltlab.wcf/templates/headIncludeJavaScript.tpl | 4 ++-- wcfsetup/install/files/acp/templates/header.tpl | 4 ++-- .../template/plugin/LangCompilerTemplatePlugin.class.php | 2 +- wcfsetup/install/lang/de.xml | 7 +++++-- wcfsetup/install/lang/en.xml | 7 +++++-- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl index b6e0500049..a792a6d0db 100644 --- a/com.woltlab.wcf/templates/headIncludeJavaScript.tpl +++ b/com.woltlab.wcf/templates/headIncludeJavaScript.tpl @@ -89,8 +89,8 @@ 'wcf.global.error.timeout': '{lang}wcf.global.error.timeout{/lang}', 'wcf.global.error.title': '{lang}wcf.global.error.title{/lang}', 'wcf.global.form.error.empty': '{lang}wcf.global.form.error.empty{/lang}', - 'wcf.global.form.error.greaterThan': '{lang}wcf.global.form.error.greaterThan.javaScript{/lang}', - 'wcf.global.form.error.lessThan': '{lang}wcf.global.form.error.lessThan.javaScript{/lang}', + 'wcf.global.form.error.greaterThan': '{lang __literal=true}wcf.global.form.error.greaterThan{/lang}', + 'wcf.global.form.error.lessThan': '{lang __literal=true}wcf.global.form.error.lessThan{/lang}', 'wcf.global.language.noSelection': '{lang}wcf.global.language.noSelection{/lang}', 'wcf.global.loading': '{lang}wcf.global.loading{/lang}', 'wcf.global.page.jumpTo': '{lang}wcf.global.page.jumpTo{/lang}', diff --git a/wcfsetup/install/files/acp/templates/header.tpl b/wcfsetup/install/files/acp/templates/header.tpl index de3398baff..5b1da7474a 100644 --- a/wcfsetup/install/files/acp/templates/header.tpl +++ b/wcfsetup/install/files/acp/templates/header.tpl @@ -87,8 +87,8 @@ 'wcf.global.error.timeout': '{lang}wcf.global.error.timeout{/lang}', 'wcf.global.error.title': '{lang}wcf.global.error.title{/lang}', 'wcf.global.form.error.empty': '{lang}wcf.global.form.error.empty{/lang}', - 'wcf.global.form.error.greaterThan': '{lang}wcf.global.form.error.greaterThan.javaScript{/lang}', - 'wcf.global.form.error.lessThan': '{lang}wcf.global.form.error.lessThan.javaScript{/lang}', + 'wcf.global.form.error.greaterThan': '{lang __literal=true}wcf.global.form.error.greaterThan{/lang}', + 'wcf.global.form.error.lessThan': '{lang __literal=true}wcf.global.form.error.lessThan{/lang}', 'wcf.global.loading': '{lang}wcf.global.loading{/lang}', 'wcf.global.page.jumpTo': '{lang}wcf.global.page.jumpTo{/lang}', 'wcf.global.page.jumpTo.description': '{lang}wcf.global.page.jumpTo.description{/lang}', diff --git a/wcfsetup/install/files/lib/system/template/plugin/LangCompilerTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/LangCompilerTemplatePlugin.class.php index a30249bce3..5fb0e6878a 100644 --- a/wcfsetup/install/files/lib/system/template/plugin/LangCompilerTemplatePlugin.class.php +++ b/wcfsetup/install/files/lib/system/template/plugin/LangCompilerTemplatePlugin.class.php @@ -32,6 +32,6 @@ class LangCompilerTemplatePlugin implements ICompilerTemplatePlugin { */ public function executeEnd(TemplateScriptingCompiler $compiler) { $compiler->popTag('lang'); - return "getDynamicVariable(ob_get_clean(), \$this->tagStack[count(\$this->tagStack) - 1][1], (isset(\$this->tagStack[count(\$this->tagStack) - 1][1]['__optional']) ? \$this->tagStack[count(\$this->tagStack) - 1][1]['__optional'] : false)); array_pop(\$this->tagStack); ?>"; + return "tagStack[count(\$this->tagStack) - 1][1]['__literal']) ? wcf\system\WCF::getLanguage()->get(ob_get_clean(), \$this->tagStack[count(\$this->tagStack) - 1][1], (isset(\$this->tagStack[count(\$this->tagStack) - 1][1]['__optional']) ? \$this->tagStack[count(\$this->tagStack) - 1][1]['__optional'] : false)) : wcf\system\WCF::getLanguage()->getDynamicVariable(ob_get_clean(), \$this->tagStack[count(\$this->tagStack) - 1][1], (isset(\$this->tagStack[count(\$this->tagStack) - 1][1]['__optional']) ? \$this->tagStack[count(\$this->tagStack) - 1][1]['__optional'] : false))); array_pop(\$this->tagStack); ?>"; } } diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index d887930418..8c970f7495 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -2112,12 +2112,15 @@ Fehler sind beispielsweise: - - + + + + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index ad0db05ee2..9c72e94eb6 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -2110,12 +2110,15 @@ Errors are: - - + + + + + -- 2.20.1