• Welcome to Simple Machines Community Forum. Please login or sign up.

[MOD] Browser Language Detection and Loading

Started by emanuele, May 06, 2012, 05:36:34 PM

Previous topic - Next topic

emanuele

May 06, 2012, 05:36:34 PM Last Edit: June 28, 2014, 10:06:36 AM by emanuele
From now I will distribute all my mods as attachments to topics in this board.
Feel free to consider them eternal betas.

Another simple mod that recognize the default language set in the browser, check if this language exists in your SMF installation and if the user is a guest and doesn't have already another language set (in session) load this as default language.

Nothing to set, nothing to translate, nothing to edit.

Compatibility: SMF 2.0.x

https://github.com/emanuele45/Browser-Language-Detection-and-Loading

Removed because broken


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Ninja ZX-10RR

Questa mod è stata ben poco considerata ma direi che almeno per il mio forum è ottima, mi serviva proprio :D la scritta in italiano perchè so che lo sei pure tu ^^ e grazie per la mod!

This mod has not been considered very much but at least for my forum is awesome, i really needed it :D thanks!
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

4Kstore


¡¡NEW MOD: Sparkles User Names!!!

emanuele

Thanks.

Well, it's just a small mod done basically for fun... :P
Glad it can be of any help! ;D


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Ninja ZX-10RR

I'll say that in English so if anyone experiences the same problem he would be able to understand what's wrong...
I randomly get the error in the attachments spamming my error log...
I'll attach the guilty file as well.
Please help T.T
[EDIT]Almost forgot. It's not actually a random guest who has produced the error, it was me  :o and i was logged in O.o
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

emanuele

Out of curiosity, what browser are you using?
Honestly I'm not that familiar with HTTP_ACCEPT_LANGUAGE, so I can just guess it is not always set.
So, the easiest fix is to change line 94 from:
Code (find) Select
$browser_langs = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
to:
Code (replace with) Select
$browser_langs = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']) : array();


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

Ninja ZX-10RR

I'm using Maxthon, a light and fast browser using stuff from both Firefox and based on Chrome, with more functions and less annoying than that xD
If you want to give it a try you can find it here, i just love it: Maxthon website the link is for the Italian language as you are Italian as well :P for anyone else you can change its language in that very same page with a button in the lower part of the page. It will be featuring also a pay-to-use thing so the more you use it and the best gifts you will receive, somehow like Blurum if you know.
Anyway thanks a lot for the fix i'll try it and see if that works :D (it should for the little coding i know it should, i'll ask again if it doesn't ;) )
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Advertisement: