Skip to content

Commit

Permalink
Language files can now be customized in the conf/ directory
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michitux committed Dec 29, 2010
1 parent 650ebc1 commit e6cecb0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
/conf/user*.css
/conf/user*.js
/conf/words.aspell
/conf/lang/*
/conf/plugin_lang/*
.htaccess
*.swp
*.bak
Expand Down
9 changes: 6 additions & 3 deletions inc/pageutils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
11 changes: 7 additions & 4 deletions inc/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,13 @@ function locale_xhtml($id) {
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;
}
Expand Down
11 changes: 7 additions & 4 deletions lib/plugins/syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,13 @@ function locale_xhtml($id) {
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;
}
Expand Down

0 comments on commit e6cecb0

Please sign in to comment.