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?
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?