diff options
author | Michael Hamann <michael@content-space.de> | 2010-12-26 23:03:16 +0100 |
---|---|---|
committer | Michael Hamann <michael@content-space.de> | 2010-12-29 21:58:39 +0100 |
commit | e6cecb0872ef457f44529edbc736aba3dc3ac258 (patch) | |
tree | 9084db13373f0d6ef381642628d2186d1056f4df | |
parent | 650ebc14deceda2e5807bb777a04ee3d476429be (diff) | |
download | rpg-e6cecb0872ef457f44529edbc736aba3dc3ac258.tar.gz rpg-e6cecb0872ef457f44529edbc736aba3dc3ac258.tar.bz2 |
Language files can now be customized in the conf/ directory
As suggested by Robin Getz locale .txt files can now be duplicated and
changed in the conf/lang/ directory and conf/plugin_lang/$plugin/
directory for plugins.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | inc/pageutils.php | 9 | ||||
-rw-r--r-- | inc/plugin.php | 11 | ||||
-rw-r--r-- | lib/plugins/syntax.php | 11 |
4 files changed, 22 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore index 2d7f2df97..4fb846732 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ /conf/user*.css /conf/user*.js /conf/words.aspell +/conf/lang/* +/conf/plugin_lang/* .htaccess *.swp *.bak diff --git a/inc/pageutils.php b/inc/pageutils.php index 42a485bdf..5d24c12bb 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -344,10 +344,13 @@ function mediaFN($id){ */ function localeFN($id){ global $conf; - $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.txt'; + $file = DOKU_CONF.'/lang/'.$conf['lang'].'/'.$id.'.txt'; if(!@file_exists($file)){ - //fall back to english - $file = DOKU_INC.'inc/lang/en/'.$id.'.txt'; + $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.txt'; + if(!@file_exists($file)){ + //fall back to english + $file = DOKU_INC.'inc/lang/en/'.$id.'.txt'; + } } return $file; } diff --git a/inc/plugin.php b/inc/plugin.php index aff07c1e5..628ae39b0 100644 --- a/inc/plugin.php +++ b/inc/plugin.php @@ -88,10 +88,13 @@ class DokuWiki_Plugin { function localFN($id) { global $conf; $plugin = $this->getPluginName(); - $file = DOKU_PLUGIN.$plugin.'/lang/'.$conf['lang'].'/'.$id.'.txt'; - if(!@file_exists($file)){ - //fall back to english - $file = DOKU_PLUGIN.$plugin.'/lang/en/'.$id.'.txt'; + $file = DOKU_CONF.'/plugin_lang/'.$plugin.'/'.$conf['lang'].'/'.$id.'.txt'; + if (!@file_exists($file)){ + $file = DOKU_PLUGIN.$plugin.'/lang/'.$conf['lang'].'/'.$id.'.txt'; + if(!@file_exists($file)){ + //fall back to english + $file = DOKU_PLUGIN.$plugin.'/lang/en/'.$id.'.txt'; + } } return $file; } diff --git a/lib/plugins/syntax.php b/lib/plugins/syntax.php index 05b0dc466..12451f636 100644 --- a/lib/plugins/syntax.php +++ b/lib/plugins/syntax.php @@ -188,10 +188,13 @@ class DokuWiki_Syntax_Plugin extends Doku_Parser_Mode { function localFN($id) { global $conf; $plugin = $this->getPluginName(); - $file = DOKU_PLUGIN.$plugin.'/lang/'.$conf['lang'].'/'.$id.'.txt'; - if(!@file_exists($file)){ - //fall back to english - $file = DOKU_PLUGIN.$plugin.'/lang/en/'.$id.'.txt'; + $file = DOKU_CONF.'/plugin_lang/'.$plugin.'/'.$conf['lang'].'/'.$id.'.txt'; + if (!@file_exists($file)){ + $file = DOKU_PLUGIN.$plugin.'/lang/'.$conf['lang'].'/'.$id.'.txt'; + if(!@file_exists($file)){ + //fall back to english + $file = DOKU_PLUGIN.$plugin.'/lang/en/'.$id.'.txt'; + } } return $file; } |