Detailed description
Hi !
I'm building an app for en-US, en-CA and fr-CA regions/languages.
Generally speaking, en-CA and en-US could share the same en.json file, but there are a few times where i'll need them to be different. Reading your doc, and the issue #13 , I thought this would be easy, but that doesn't seem to work. Maybe i'm getting something wrong.
Context
My current locale is fr-CA
I have a ressources/lang/fr-CA.json file that looks like this:
{ "en-CA": "Canada (English)", "fr-CA": "Canada (Français)", "en-US": "United States (English)" }
I created an override file in: ressources/lang/lang-country-overrides/fr-CA.json
in which I define "lang" as "fr-CA" instead of just "fr"
{ "country": "CA", "country_name": "Canada", "country_name_local": "Canada", "lang": "fr-CA", "name": "Canada (Français)", "date_numbers": "d/m/Y", "date_numbers_full_capitals": "DD/MM/YYYY", "date_words_without_day": "j F Y", "date_words_with_day": "l j F Y", "date_birthday": "j F", "time_format": "h:i a", "emoji_flag": "🇨🇦", "currency_code": "CAD", "currency_symbol": "$", "currency_symbol_local": "$CAD", "currency_name": "Canadian Dollar", "currency_name_local": "Dollars Canadien" }
In a component I call {{ __($lang['lang_country']) }}
This should look at ressources/lang/fr-CA.json for the current lang_country key, which is fr-CA
and display Canada (Français)
, but I only get fr-CA
, so the translation did not happen.
If I rename ressources/lang/fr-CA.json to fr.json, it will work... So it seems, even if i've set lang in the override, that it's still looking for the fr.json file
I know the override file gets loaded because if I output name
, I get Canada (Français)
instead of the default name.
(I know I can use this as a workaround for what I originally intended to do, but the problem still persists and I'll still have a problem later when I want a different translation between en-CA and en-US)
So the override file seems to work, but then it fails to load the proper lang json file.
environment
This is Laravel 8 and this lib's latest release, 2.4.1
Thanks for your help :)