basz / SlmLocale

Auto detection of locale through different strategies for Zend Framework 2
Other
67 stars 34 forks source link

Locale mapping feature #73

Closed fwwarr closed 7 years ago

fwwarr commented 9 years ago

Implemented feature described in this comment.

A set of mappings can be defined to map a detected locale or generic language to the one to actually use.

Most common use case is to support and detect a generic language (e.g. "en"), but have a specific locale be set (e.g. "en-US") for all locales that match the generic one.

fwwarr commented 7 years ago

Hi @basz any chance this might be considered for a merge soon? It's a relatively simple but useful feature and I've provided unit tests and documentation updates. Thanks!

svycka commented 7 years ago

@fwwarr I am not sure about use case for this. Why can't you have en as supported locale and all en-* will fallback to this.

fwwarr commented 7 years ago

Hi @svycka, I see two use cases for this:

  1. Our main use case is to have all en-* map to en-CA (not just to en) in order for currencies, number and date formats, etc. to display according to en-CA for all clients that accept en-XX.
  2. Another use case would be to support separate locales en-US and en-GB and have en or en-* map to en-US but en-CA map to en-GB.
svycka commented 7 years ago

@fwwarr can you rebase and change arrays to sort array syntax?

jroedel commented 7 years ago

This would really help me a lot, hope we can move forward to close this :+1:

basz commented 7 years ago

Will have a look later... im sure we can solve it

svycka commented 7 years ago

This is already merged in https://github.com/basz/SlmLocale/pull/87