blob: a4580022b3058fbb4ecb8cb48c156d2f22cec1bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
<?php
function i18n($i18n)
{
return [
'translate' => function ($id) use ($i18n) {
return $i18n[$_GET['lang'] ?? 'de'][$id] ?? $i18n['de'][$id];
},
'link_page' => function ($page) {
$locale = $_GET['lang'] ?? 'de';
$page = trim($page, '/');
$link = "/$locale/$page";
return $link;
},
'link_language' => function ($locale) {
$page = trim($_GET['page'], '/');
$link = "/$locale/$page";
return $link;
},
'inactive_languages' => function () {
return array_values(array_diff(['de', 'en', 'jp'], [$_GET['lang'] ?? 'de']));
},
];
}
|