- commit
- b6b9b34abd086d49b254671b907a11ccbf779f1c
- parent
- 266206563c00a1f7b4517ec0cc9b9ec87d315acd
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2019-08-11 08:03
implement admin-UI translation
Diffstat
| M | utils.php | 27 | ++++++++++++++++++++++++++- |
1 files changed, 26 insertions, 1 deletions
diff --git a/utils.php b/utils.php
@@ -1,10 +1,35 @@ 1 1 <?php declare(strict_types=1); 2 2 -1 3 require_once __DIR__ . '/vendor/autoload.php'; -1 4 use Symfony\Component\Yaml\Yaml; -1 5 use Symfony\Component\Yaml\Exception\ParseException; -1 6 3 7 class WriteException extends Exception {} 4 8 -1 9 function get_translation() -1 10 { -1 11 if (!include('HTTP2.php')) { -1 12 return array(); -1 13 }; -1 14 -1 15 $http = new HTTP2(); -1 16 $LANG = $http->negotiateLanguage(array( -1 17 'de' => true, -1 18 )); -1 19 -1 20 try { -1 21 return Yaml::parseFile("trans/$LANG.yml"); -1 22 } catch (ParseException $e) { -1 23 return array(); -1 24 } -1 25 } -1 26 -1 27 $TRANS = get_translation(); -1 28 5 29 function trans($s) 6 30 {7 -1 return $s;-1 31 global $TRANS; -1 32 return isset($TRANS[$s]) ? $TRANS[$s] : $s; 8 33 } 9 34 10 35 function rmdirs($path)