1 | <?php |
||
2 | /** |
||
3 | * Translation UI for the localizable strings in the package. |
||
4 | * |
||
5 | * @package Application Utils |
||
6 | * @subpackage Localization |
||
7 | * @author Sebastian Mordziol <[email protected]> |
||
8 | */ |
||
9 | |||
10 | declare(strict_types=1); |
||
11 | |||
12 | use AppLocalize\Localization; |
||
13 | use function AppLocalize\t; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
14 | |||
15 | $root = __DIR__; |
||
16 | $autoload = $root.'/vendor/autoload.php'; |
||
17 | |||
18 | // we need the autoloader to be present |
||
19 | if($autoload === false) |
||
0 ignored issues
–
show
|
|||
20 | { |
||
21 | die('<b>ERROR:</b> Autoloader not present. Run composer update first.'); |
||
22 | } |
||
23 | |||
24 | /** |
||
25 | * The composer autoloader |
||
26 | */ |
||
27 | require_once $autoload; |
||
28 | |||
29 | // add the locales we wish to manage (en_UK is always present) |
||
30 | Localization::addAppLocale('de_DE'); |
||
31 | Localization::addAppLocale('fr_FR'); |
||
32 | |||
33 | // has to be called last after all sources and locales have been configured |
||
34 | Localization::configure($root.'/storage.json', ''); |
||
35 | |||
36 | $installFolder = realpath(__DIR__.'/../'); |
||
37 | |||
38 | // Register the classes as a localization source, |
||
39 | // so they can be found, and use the bundled localization |
||
40 | // files. |
||
41 | Localization::addSourceFolder( |
||
42 | 'application-utils-translation-ui', |
||
43 | 'Application Utils translation UI', |
||
44 | 'Composer Packages', |
||
45 | $installFolder.'/localization', |
||
46 | $root |
||
47 | )->excludeFolder('vendor'); |
||
48 | |||
49 | // create the editor UI and start it |
||
50 | $editor = Localization::createEditor(); |
||
51 | |||
52 | $editor->setAppName(t('AppUtils translation UI')); |
||
53 | |||
54 | $editor->setBackURL( |
||
55 | 'https://github.com/Mistralys/application-utils', |
||
56 | t('Project Github page') |
||
57 | ); |
||
58 | |||
59 | $editor->display(); |
||
60 |