maximeschoeni / sublanguage

Multilanguage plugin for wordpress
42 stars 13 forks source link

Several Locale for 1 lang ? #2

Closed tvass closed 8 years ago

tvass commented 8 years ago

Hi there, Is there a way to have several Locale for 1 language only ? For example, i would like to have "fr_FR", "fr_CA" and "fr" to use French. Any idea please ?

If i create several language do_action('sublanguage_print_language_switch') will print all French versions available instead of one "French".

Thanks

maximeschoeni commented 8 years ago

Hello, no, sorry, currently you cannot set multiple locale code for one language. But why would you need that? I don't get it...

tvass commented 8 years ago

When you do a translation, fr_FR and fr_CA are same content. I don't see the point to have multiple translations in this case.

maximeschoeni commented 8 years ago

Of course, but why not just have only one language for french in this case?

tvass commented 8 years ago

Auto detection does not redirect to /fr/ (locale fr_FR) when my locales is set to French Canada (fr_CA) in Firefox. It redirects to sublanguage default lang (which is english in my case). I guess i missed something :)

maximeschoeni commented 8 years ago

Ok, I got it now. Of course fr_CA should redirect to fr (if it exists) instead of en. I am going to fixe it for next release. Thank you for pointing this issue.

tvass commented 8 years ago

Your code seems to ignore others languages advertised by the browser. When it fails to find the first one, sublanguage should try to find the second one and so on before falling back to default.

For now, when it failed to find the first one, it redirects to default sublanguage lang.

Here is the configuration on my browser :

Meaning Quality fr-FR 1 fr 0.8 en-US 0.6 en 0.4

My sublanguage installation was configured for "fr". That's why i am redirected to sublanguage default lang ("en" in my case).

Thanks, Thomas

maximeschoeni commented 8 years ago

I commited changes for better detecting language. It is available from 1.5.2

tvass commented 8 years ago

It works now. Thanks