[ previous ] [ next ] [ threads ]
 
 From:  YvesDM <ydmlog at gmail dot com>
 Cc:  "Monowall Support List" <m0n0wall at lists dot m0n0 dot ch>
 Subject:  Re: [m0n0wall] Captive portal, multilingual login page
 Date:  Thu, 24 Apr 2008 15:19:51 +0100
Hi,

i thougt I found a solution using the code below.
I use this code as landing page and upload my different lang.html login
pages with the filemanager.
It works, except redirection after succesfull login fails. (so I stay on the
landign page untill i manually browse to another page)
So I get a login page and can login, but the ?redirect%http... at the end of
the landing page url isn't there anymore.

Any suggestions?
Kind regards
Y

<script>

//Enter ISO 639-2 letter Language codes to detect (see:
http://www.w3.org/WAI/ER/IG/ert/iso639.htm):
var langcodes=new Array("en", "fr", "es", "ja", "zh", "default")

//Enter corresponding redirect URLs (last one is for default URL):
var langredirects=new Array("index.htm", "french.htm", "spanish.htm",
"japan.htm", "chinese.htm", "index.htm")

var languageinfo=navigator.language? navigator.language :
navigator.userLanguage
var gotodefault=1

function redirectpage(dest){
if (window.location.replace)
window.location.replace(dest)
else
window.location=dest
}

for (i=0;i<langcodes.length-1;i++){
if (languageinfo.substr(0,2)==langcodes[i]){
redirectpage(langredirects[i])
gotodefault=0
break
}
}

if (gotodefault)
redirectpage(langredirects[langcodes.length-1])


</script>



On Wed, Apr 23, 2008 at 6:11 PM, Carsten Holbach <Carsten dot Holbach at gmx dot de>
wrote:

> Detect browser language (you might change that for IE):
> |
> http://www.devmag.net/tricks/js/javascript_8.htm
>
> <script type=text/javascript>
> <!--
> // Das Script stammt von Werner Zenk
>
> if (navigator.appName == 'Netscape')
> var language = navigator.language
> else
> var language = navigator.browserLanguage
> var lang = ""

> else if (language.indexOf('pl') > -1) lang="Dzien' dobry";
> else if (language.indexOf('ro') > -1) lang="Binevenit";
> else if (language.indexOf('kl') > -1) lang="Ilaali";
> else if (language.indexOf('bg') > -1) lang="Dobro utro";
> else if (language.indexOf('af') > -1) lang="Welkom";
> else if (language.indexOf('ar') > -1) lang="Sabah al khair";
> else if (language.indexOf('zh') > -1) lang="Ni hao";

> else if (language.indexOf('da') > -1) lang="Hallo";
> else if (language.indexOf('nl') > -1) lang="Welkom";
> else if (language.indexOf('eo') > -1) lang="Bonvenigi";
> else if (language.indexOf('fi') > -1) lang="Hei";
> else if (language.indexOf('fr') > -1) lang="Bienvenue";
> else if (language.indexOf('de') > -1) lang="Willkommen";
> else if (language.indexOf('hu') > -1) lang="Isten hozta!";
> else if (language.indexOf('it') > -1) lang="Benvenuto";
> else if (language.indexOf('ja') > -1) lang="Kouguu";

> else if (language.indexOf('la') > -1) lang="Ave";
> else if (language.indexOf('no') > -1) lang="Hei";

> else if (language.indexOf('en') > -1) lang="Welcome";
> else if (language.indexOf('tr') > -1) lang="Merhaba";
> else if (language.indexOf('es') > -1) lang="Bienvenida";
> else if (language.indexOf('sv') > -1) lang="Hej";
> else if (language.indexOf('cy') > -1) lang="Croeso";
> else if (language.indexOf('zu') > -1) lang="Sawubona";
> else if (language.indexOf('pt') > -1) lang="Bem-vindo";
> document.write(lang);
> // -->
> </SCRIPT>
>
>
> |
> YvesDM schrieb:
>
>  That indeed is a solution.
>> Pity my javascript-fu sucks :-)
>> If someone has some basic example, it would be a good point to start.
>>
>> Many tnx
>> Y
>>
>>
>> On Wed, Apr 23, 2008 at 4:59 PM, Carsten Holbach <Carsten dot Holbach at gmx dot de>
>> wrote:
>>
>>
>>
>>> You could do this with JavaScript.
>>> Not the best solution, but that would work.
>>>
>>>
>>> YvesDM schrieb:
>>>
>>>  That would be lovely !
>>>
>>>
>>>> But, the login page of the captive portal doesn't parse php and can only
>>>> be
>>>> plain html, so it will never work ;-)
>>>>
>>>> Kind regards,
>>>> Y
>>>>
>>>>
>>>> On Wed, Apr 23, 2008 at 4:00 PM, Dennis Karlsson <
>>>> dennis at denniskarlsson dot com>
>>>> wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Hi
>>>>>
>>>>> Why not use HTTP_ACCEPT_LANGUAGE in conjunction with cookie based
>>>>> settings?
>>>>>
>>>>> If the use never been to the page, the language is based on
>>>>> HTTP_ACCEPT_LANGUAGE. If the user prefer some other language they may
>>>>> choose
>>>>> in some drop down menu.
>>>>>
>>>>> Just an idea.
>>>>>
>>>>> / Dennis
>>>>>
>>>>>
>>>>>
>>>>> YvesDM wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I use captive portal with radius and need multilingual login pages
>>>>>> on
>>>>>> some
>>>>>> locations.
>>>>>> Anyone who has an idea on how to get to this with m0n0wall?
>>>>>> Ideally, users choose there language once, receive a cookie and
>>>>>> there
>>>>>> loginpage language is remembered the next time they arrive on the
>>>>>> loginpage.
>>>>>> But, the CP login/error pages can only be plain html as far as I
>>>>>> know
>>>>>> :-(
>>>>>>
>>>>>> Any ideas to work around this?
>>>>>> Kind regards
>>>>>> Y.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: m0n0wall dash unsubscribe at lists dot m0n0 dot ch
>>>>> For additional commands, e-mail: m0n0wall dash help at lists dot m0n0 dot ch
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: m0n0wall dash unsubscribe at lists dot m0n0 dot ch
>>> For additional commands, e-mail: m0n0wall dash help at lists dot m0n0 dot ch
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: m0n0wall dash unsubscribe at lists dot m0n0 dot ch
> For additional commands, e-mail: m0n0wall dash help at lists dot m0n0 dot ch
>
>