Is it possible to override json data under symfony/src/Symfony/Component/Intl/Resources
? For example, in data/languages/en.json
I would like to change "zh": "Chinese"
to be more specifically "zh": "Mandarin Chinese"
.
Asked
Active
Viewed 588 times
2 Answers
1
I'm not the pro with Symfony, but i get the same question and for me, i did find a workaround that works. I didn't use it in forms, i use it only to display.
I did create a Model called Country for accessing and manipulating the RegionBundle:
namespace AppBundle\Model;
use Symfony\Component\Intl\Data\Bundle\Reader\BufferedBundleReader;
use Symfony\Component\Intl\Data\Bundle\Reader\BundleEntryReader;
use Symfony\Component\Intl\Data\Bundle\Reader\JsonBundleReader;
use Symfony\Component\Intl\Intl;
use Symfony\Component\Intl\ResourceBundle\RegionBundle;
class Country
{
public static function getCountryName($countryCode, $locale='de')
{
$test = new RegionBundle(
__DIR__.'/../Resources/Intl/data'.'/'.Intl::REGION_DIR,
new BundleEntryReader(new BufferedBundleReader(
new JsonBundleReader(),
Intl::BUFFER_SIZE
)),
Intl::getLocaleBundle()
);
return $test->getCountryName($countryCode, $locale);
}
}
And from a controller, i can call them with:
Country::getCountryName('AF')
Maybe this is not the "state of the art" approach, but i was spending hours of searching another solution - but dont find any approach that is useable for me.

rebru
- 519
- 3
- 10
0
Did you tried to copy that file under app/Resources/data/languages/en.json than change it over there?
Also don't forget to clear cache

MustafaB
- 212
- 3
- 10
-
Tried both `app/Resources/data/languages/en.json` as well as `app/Resources/Intl/data/languages/en.json` but no joy. – nurikabe Jul 21 '15 at 23:06
-
Now try to copy in **src/YOURBUNDLE/Resources/data/languages/en.json** – Absalón Valdés Jul 22 '15 at 01:30
-
Tried this as well. No dice. – nurikabe Jul 22 '15 at 02:38
-
@nurikabe did you have any luck with that? – Pavel Dubinin Apr 25 '17 at 11:10
-
@PavelDubinin No, I eventually gave up. Haven't revisited this issue. – nurikabe May 01 '17 at 21:01