Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- <<<CONFIG
- packages:
- - "twig/twig: ^2"
- - "twig/intl-extra: 3.x-dev"
- - "symfony/var-dumper: ^4"
- CONFIG;
- $loader = new \Twig\Loader\ArrayLoader([
- 'ok_fr' => "{{ 'fr'|language_name }}\n",
- 'ok_fr_CA' => "{{ 'fr_CA'|language_name }}\n",
- 'ko_fr_FR' => "{{ 'fr_FR'|language_name }}\n",
- ]);
- $twig = new \Twig\Environment($loader);
- $twig->addExtension(new \Twig\Extra\Intl\IntlExtension());
- echo $twig->render('ok_fr'); // French
- echo $twig->render('ok_fr_CA'); // Canadian French
- try {
- echo $twig->render('ko_fr_FR');
- } catch (\Exception $e) {
- dump($e);
- }
- /*
- Twig\Error\RuntimeError^ {#159
- -lineno: 1
- -name: "ko_fr_FR"
- -rawMessage: "An exception has been thrown during the rendering of a template ("Couldn't read the indices [Names][fr_FR] for the locale "en_US" in "/path/vendor/symfony/intl/Resources/data/languages". The indices also couldn't be found for the fallback locale(s) "en", "root".")."
- -sourcePath: ""
- -sourceCode: ""
- #message: "An exception has been thrown during the rendering of a template ("Couldn't read the indices [Names][fr_FR] for the locale "en_US" in "/path/vendor/symfony/intl/Resources/data/languages". The indices also couldn't be found for the fallback locale(s) "en", "root".") in "ko_fr_FR" at line 1."
- #code: 0
- #file: "/path/vendor/twig/twig/src/Template.php"
- #line: 421
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement