From e6cecb0872ef457f44529edbc736aba3dc3ac258 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sun, 26 Dec 2010 23:03:16 +0100 Subject: 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. --- inc/pageutils.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'inc/pageutils.php') 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; } -- cgit v1.2.3 From 01032c33d1c2c00e6c2f04f0bdd9b9ac0057ded6 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sun, 9 Jan 2011 12:59:58 +0100 Subject: Fix FS#2131 - metaFiles returning unrelated files --- inc/pageutils.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'inc/pageutils.php') diff --git a/inc/pageutils.php b/inc/pageutils.php index 5d24c12bb..216debd9a 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -316,9 +316,8 @@ function metaFiles($id){ $name = noNS($id); $ns = getNS($id); $dir = ($ns) ? metaFN($ns,'').'/' : metaFN($ns,''); - $files = array(); - $files = glob($dir.$name.'.*'); - return $files; + $files = glob($dir.$name.'.*', GLOB_MARK); + return $files ? preg_grep('/^'.preg_quote($dir.$name, '/').'\.[^.\/]*$/u', $files) : array(); } /** -- cgit v1.2.3 From ba0267b3bcb1b5feeb707e9a92766c4a619409bb Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Wed, 12 Jan 2011 20:46:36 +0100 Subject: Fix metaFiles for ids that require utf-8 escaping Before this change metaFiles didn't return anything for ids where the part without the namespace needs (utf-8) filename escaping. --- inc/pageutils.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'inc/pageutils.php') diff --git a/inc/pageutils.php b/inc/pageutils.php index 216debd9a..cd01dcae7 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -311,13 +311,13 @@ function metaFN($id,$ext){ * returns an array of full paths to all metafiles of a given ID * * @author Esther Brunner + * @author Michael Hamann */ function metaFiles($id){ - $name = noNS($id); - $ns = getNS($id); - $dir = ($ns) ? metaFN($ns,'').'/' : metaFN($ns,''); - $files = glob($dir.$name.'.*', GLOB_MARK); - return $files ? preg_grep('/^'.preg_quote($dir.$name, '/').'\.[^.\/]*$/u', $files) : array(); + $basename = metaFN($id, ''); + $files = glob($basename.'.*', GLOB_MARK); + // filter files like foo.bar.meta when $id == 'foo' + return $files ? preg_grep('/^'.preg_quote($basename, '/').'\.[^.\/]*$/u', $files) : array(); } /** -- cgit v1.2.3