From c7c3db8c54ada33c785a7303de582a3d0c1a14ee Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Wed, 6 Oct 2010 17:40:58 -0700 Subject: [PATCH] i18n officially ready for prime time. --- boot.php | 15 +++++++++++++-- include/Contact.php | 21 +++++++++++++++++++++ index.php | 6 +++++- util/README | 15 +++++++++++++-- 4 files changed, 52 insertions(+), 5 deletions(-) diff --git a/boot.php b/boot.php index 7bf3e75a6b..194ee6a01b 100644 --- a/boot.php +++ b/boot.php @@ -169,6 +169,15 @@ class App { }} +// retrieve the App structure +// useful in functions which require it but don't get it passed to them + +if(! function_exists('get_app')) { +function get_app() { + global $a; + return $a; +}}; + // Multi-purpose function to check variable state. // Usage: x($var) or $x($array,'key') @@ -269,19 +278,21 @@ function replace_macros($s,$r) { // load string tranlsation table for alternate language -// not yet implemented if(! function_exists('load_translation_table')) { function load_translation_table($lang) { global $a; + if(file_exists("view/$lang/strings.php")) + include("view/$lang/strings.php"); }} // translate string if translation exists if(! function_exists('t')) { function t($s) { - global $a; + + $a = get_app(); if($a->strings[$s]) return $a->strings[$s]; diff --git a/include/Contact.php b/include/Contact.php index c59038e5d7..a915ae0b44 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -1,6 +1,27 @@