summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2010-03-14 14:11:52 -0700
committerArun Persaud <arun@nubati.net>2010-03-14 14:33:31 -0700
commit83fc1a851c69e13808d14f2d5a284c3369409018 (patch)
tree67d2da7a1481269aa939b898f3fd1be4507cf869 /index.php
parentc05246b378470eab9c172d8d96328a821302a273 (diff)
downloade-DoKo-83fc1a851c69e13808d14f2d5a284c3369409018.tar.gz
e-DoKo-83fc1a851c69e13808d14f2d5a284c3369409018.tar.bz2
e-DoKo-83fc1a851c69e13808d14f2d5a284c3369409018.zip
NEW FEATURE: added localization support
using gettext to add support for localization
Diffstat (limited to 'index.php')
-rw-r--r--index.php33
1 files changed, 30 insertions, 3 deletions
diff --git a/index.php b/index.php
index 54efdcb..61b0e3f 100644
--- a/index.php
+++ b/index.php
@@ -51,7 +51,36 @@ if($DBopen<0)
exit();
}
-/* done major error checking, output5B header of HTML page */
+/* localization */
+/* needs to be in front of output_header, but we don't know the users preferences at this time,
+ * so we go by the session variable or if language is set
+ */
+if(myisset('language') || isset($_SESSION['language']))
+ {
+ $language = 'en';
+ if(isset($_SESSION['language']))
+ $language = $_SESSION['language'];
+ if(myisset('language'))
+ {
+ $language = $_REQUEST['language'];
+ $_SESSION['language'] = $language; /* overrule preferences */
+ }
+ switch($language)
+ {
+ case 'de':
+ putenv("LC_ALL=de_DE");
+ setlocale(LC_ALL, "de_DE");
+ // Specify location of translation tables
+ bindtextdomain("edoko", "./locale");
+ // Choose domain
+ textdomain("edoko");
+ break;
+ default:
+ /* do nothing */
+ }
+ }
+
+/* done major error checking, output header of HTML page */
output_header();
/* The rest of the file consists of handling user input.
@@ -120,5 +149,3 @@ DB_close();
*End:
*/
?>
-
-