aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorwinter2024-12-24 17:46:51 +0000
committerwinter2024-12-24 17:46:51 +0000
commit721674973ca0a4d98cd081e9ff130c3356ddac03 (patch)
tree5caa082baa4f23bd8a88f4f268fea6d9233f6553 /index.php
parentd5a57276eb27e215dd0b1bd5eb67ac26acc9575b (diff)
implement ui translations using gettext
this was horrible i don't like gettext anymore
Diffstat (limited to 'index.php')
-rw-r--r--index.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/index.php b/index.php
index 617dc0e..dafc999 100644
--- a/index.php
+++ b/index.php
@@ -11,4 +11,13 @@ function require_all_glob(string $pattern) {
require_all_glob('routes/*.php');
require_all_glob('misc/*.php');
+$lang = get_ui_language();
+header('Content-Language: ' . str_replace('_', '-', $lang));
+putenv("LANG=$lang");
+setlocale(LC_MESSAGES, $lang);
+
+bindtextdomain('digitigrade', __DIR__ . '/locale');
+bind_textdomain_codeset('digitigrade', 'UTF-8');
+textdomain('digitigrade');
+
Digitigrade\Router::getInstance()->processRequest();