dougwollison / nlingual

Versatile and flexible multilingual system for WordPress.
https://wordpress.org/plugins/nlingual/
GNU General Public License v2.0
13 stars 7 forks source link

Default language works only for English #19

Closed samanzamani closed 2 years ago

samanzamani commented 2 years ago

Hi I try to use Persian and English language for my WordPress. I want to set Persian as default and English as a second language. So I added two languages and activated Skip Localization for Default Language option in the admin panel. Then I changed Permalink to Plain and seated it back to Post name. Now, when I open my website, it redirects to /en/ while I put Persian as default, and I was active skip localization for the default language. But when it sets on English as the default language, everything works normally.

Plugin version: 2.9.1.2 Wordpress: 5.8.1

dougwollison commented 2 years ago

Is your browser's language set to English? If so then this sounds like it's working intentionally; the system checks the visitor's language preferences and redirects accordingly when no language is specified in the URL. If a visitor prefers, say, Spanish, then it'll default to the Persian side of the site since there's no support for Spanish, only Persian + English.

You should be able to view the Persian side of the site using /fa/ (or whatever you set the Slug to). If you set your browser's language to Persian (or any other language), visiting / on the website should stick to the Persian homepage.

samanzamani commented 2 years ago

Hi @dougwollison Thank you for your explanation. Yes, my browser language sets on English. Is there any way to change this behavior? Because most people in Iran (where we speak Persian) use browsers with English default language while they want to see websites in Persian.

samanzamani commented 2 years ago

I change accepted_language method in Registry class to always returns false and now everything works as I expected. I think it's a good idea to add an option to make this feature enable and disable. Thanks :)

dougwollison commented 2 years ago

Huh... okay did not consider that. I'll see about adding an opt-out option for that.

dougwollison commented 2 years ago

Update: took a while to get around to this but I've added an option to opt-out of the accepted language handling; will be releasing an update with this feature and a few other improvements in the coming days.