summaryrefslogtreecommitdiff
path: root/inc/template.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2013-08-02 10:47:58 -0700
committerAndreas Gohr <andi@splitbrain.org>2013-08-02 10:47:58 -0700
commit18ce55ed82c3241469c3b29caef3a5c21c501d68 (patch)
treeb40e2a47dfadd7f78e8a20e4f4ffcf97815df32a /inc/template.php
parentff76de0a14da478428d8eabcdd11dea933badc54 (diff)
parentc5c17fdaa1af326a3f0c68695cb93575a3af2e5e (diff)
downloadrpg-18ce55ed82c3241469c3b29caef3a5c21c501d68.tar.gz
rpg-18ce55ed82c3241469c3b29caef3a5c21c501d68.tar.bz2
Merge pull request #251 from splitbrain/localizetemplate
Localizetemplate
Diffstat (limited to 'inc/template.php')
-rw-r--r--inc/template.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/inc/template.php b/inc/template.php
index d03d3561b..ca1c8d9d5 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -1189,6 +1189,34 @@ function tpl_getLang($id) {
}
/**
+ * Retrieve a language dependent file and pass to xhtml renderer for display
+ * template equivalent of p_locale_xhtml()
+ *
+ * @param string $id id of language dependent wiki page
+ * @return string parsed contents of the wiki page in xhtml format
+ */
+function tpl_locale_xhtml($id) {
+ return p_cached_output(tpl_localeFN($id));
+}
+
+/**
+ * Prepends appropriate path for a language dependent filename
+ */
+function tpl_localeFN($id) {
+ $path = tpl_incdir().'lang/';
+ global $conf;
+ $file = DOKU_CONF.'/template_lang/'.$conf['template'].'/'.$conf['lang'].'/'.$id.'.txt';
+ if (!@file_exists($file)){
+ $file = $path.$conf['lang'].'/'.$id.'.txt';
+ if(!@file_exists($file)){
+ //fall back to english
+ $file = $path.'en/'.$id.'.txt';
+ }
+ }
+ return $file;
+}
+
+/**
* prints the "main content" in the mediamanger popup
*
* Depending on the user's actions this may be a list of