Last active
August 13, 2019 17:44
-
-
Save mykiwi/1b7cda226efdb9020551b467c702c37f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment