forked from ReimuHakurei/phpPgAdmin
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLanguage.php
More file actions
54 lines (50 loc) · 1.48 KB
/
Language.php
File metadata and controls
54 lines (50 loc) · 1.48 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
declare(strict_types=1);
namespace PhpPgAdmin;
final class Language
{
/**
* @return array<string, string>
*/
public static function getAvailableLanguageIdsWithLocales(): array
{
return [
'afrikaans' => 'af_ZA',
'arabic' => 'ar_SA',
'catalan' => 'ca_ES',
'chinese-zh-cn' => 'zh_CN',
'chinese-zh-tw' => 'zh_TW',
'czech' => 'cs_CZ',
'danish' => 'da_DK',
'dutch' => 'nl_NL',
'english' => 'en_US',
'french' => 'fr_FR',
'galician' => 'gl_ES',
'german' => 'de_DE',
'greek' => 'el_GR',
'hebrew' => 'he_IL',
'hungarian' => 'hu_HU',
'italian' => 'it_IT',
'japanese' => 'ja_JP',
'lithuanian' => 'lt_LT',
'mongol' => 'mn_MN',
'polish' => 'pl_PL',
'portuguese-br' => 'pt_BR',
'portuguese-pt' => 'pt_PT',
'romanian' => 'ro_RO',
'russian' => 'ru_RU',
'slovak' => 'sk_SK',
'spanish' => 'es_ES',
'swedish' => 'sv_SE',
'turkish' => 'tr_TR',
'ukrainian' => 'uk_UA',
];
}
public static function setLocale(string $locale): void
{
putenv("LANGUAGE={$locale}");
putenv("LC_ALL={$locale}.UTF-8");
setlocale(LC_ALL, ["{$locale}.UTF-8", $locale, substr($locale, 0, 2)]);
textdomain('messages');
}
}