This topic was marked solved by its starter, on April 1st, 2014, 08:11 PM
Poll

Which language should Wedge switch its UI to, by default?

User's choice, then your browser's language (if available in the installed language list), then the site's default language.
8 (72.7%)
Alanthar, Bunstonious, Drunken Clam, godboko71, madfitz, Nao, Pandos, Powerbob
User's choice, then the site's default language.
1 (9.1%)
Norodo
No comprendo le français. Oh, was that in English? Sorry.
2 (18.2%)
Farjo, txcas
Total Members Voted: 11

Nao

  • Dadman with a boy
  • Posts: 16,061
Poll: Default language
« on March 25th, 2014, 05:59 PM »
I was just wondering...
Two years ago, I added some code to the Wedge installer so that it detects your browser's default language, and then proceeds to show you the most appropriate language for the installer (either English, French or German.)
I was updating that to add German (it was missing), and then it struck me that maybe it should be done in all pages for guests..?!

- Does the user have a preference set in a cookie or session variable? Then use that.
- Otherwise, attempt to determine list of favorite browser languages.
- If it's available as a Wedge language (usually, all browsers have at least English as a fallback anyway), then use the language with the highest priority.
- If not, then use the forum's default language. Or, if this one's not even set, then English.

That's basically what the installer does. It does take some time to execute (a preg_match_all on a short string, a strtolower, an array_combine, 2 foreach's and a short array sort), but probably less than a millisecond. I guess, ideally, that would be nice for non-English users.

What do you think, guys..? Worth the minor performance hit or not? Should I do this only on guests, or everyone?

Farjo

  • "a valuable asset to the community"
  • Posts: 492
Re: Poll: Default language
« Reply #1, on March 25th, 2014, 08:53 PM »
If you're going to do it you should do it for everyone otherwise the site will look good to a guest who will then be lost once registered.

Nao

  • Dadman with a boy
  • Posts: 16,061
Re: Poll: Default language
« Reply #2, on March 25th, 2014, 10:27 PM »
I guess so. Can simply skip the whole detection code if a preferred language was entered before of course.