micheleangioni / laravel-js-lang-converter

Laravel lang files conversion to Javacript
MIT License
25 stars 8 forks source link

Update lang.js::_.getPluralForm #4

Closed jwall-sycle closed 8 years ago

jwall-sycle commented 8 years ago

In our system, and I'm sure many others. We use a suffix country code when setting our locale for certain regions. ie. en_US, en_CA, en_GB.

The switch statement is based on the language code and not the locale. It should take the first two characters of the locale instead (the language code.)

micheleangioni commented 8 years ago

Hi @jwall-sycle , thanks for your PR. However for this package I aim to remain consistent with Laravel (which takes the same convention from Symfony) by continuing to use the locale.

jwall-sycle commented 8 years ago

Thanks for you're feedback. I've been poking around and it seems like it might be something thats addressed in laravel 5.3!

https://github.com/laravel/framework/issues/11792

jwall-sycle commented 8 years ago

http://symfony.com/doc/current/reference/forms/types/locale.html

micheleangioni commented 8 years ago

Thanks for the laravel issue, I'll take an eye on it! :)

matthew-sycle commented 8 years ago

Could you possibly reconsider this, @micheleangioni? This was a breaking change for us, as Symfony uses Lang vs Locale correctly (see above links), but Laravel is conflating them. For example, we have regional language differences for different English Locales (British vs. US vs. Australia, etc).

At the very least, it would be nice if this package could "fail gracefully" by stripping off the option Country specifier, until Laravel fixes this in 5.3.

micheleangioni commented 8 years ago

@matthew-sycle generally speaking I wish to continue to follow the Laravel standard. I'll be ready to change convention if Laravel 5.3 changes its own.

However, how do you suggest it should "fail gracefully"? One idea could be to take the first two characters from 'en_US', 'en_CA', 'en_GB' so that all three goes to 'en'.

matthew-sycle commented 8 years ago

Yeah, that makes a lot of sense to me! I think in most cases, pluralization patterns are per-language, not per-country, so that should work.

micheleangioni commented 8 years ago

@matthew-sycle ok, I'll work on that in the weekend