aboutsummaryrefslogtreecommitdiffhomepage
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/__.php7
-rw-r--r--misc/get_ui_language.php4
2 files changed, 9 insertions, 2 deletions
diff --git a/misc/__.php b/misc/__.php
new file mode 100644
index 0000000..af6366a
--- /dev/null
+++ b/misc/__.php
@@ -0,0 +1,7 @@
+<?php
+
+use Digitigrade\Text;
+
+function __(string $key): string {
+ return (new Text($key))->__tostring();
+} \ No newline at end of file
diff --git a/misc/get_ui_language.php b/misc/get_ui_language.php
index b1305b3..712b6c5 100644
--- a/misc/get_ui_language.php
+++ b/misc/get_ui_language.php
@@ -4,8 +4,8 @@ function get_ui_language(?array $possibleLanguages = null): string {
if ($possibleLanguages == null) {
$possibleLanguages = array_map(function ($path) {
$parts = explode('/', $path);
- return $parts[count($parts) - 2];
- }, glob(__DIR__ . '/../locale/*/LC_MESSAGES'));
+ return str_replace('.json', '', $parts[count($parts) - 1]);
+ }, glob(__DIR__ . '/../locale/*.json'));
}
if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {