Author |
Topic  |
|
wab73
Starting Member
Netherlands
6 Posts |
Posted - 29 April 2002 : 05:12:21
|
Hi,
I'm testing the 4.b3 (incl. all post b3 updates) version using english & dutch. Now i'm trying to define the lang outside the forum. (my page allready uses a lang selector, so I want to open the forum using this selected lang) My page passes a var using the URL (www...com/test.asp?Lang=US )
How do I set the Lang before the forum page is loaded? (Can I set the cookie.. and how do i do that?) or should i change something in the forum pages to set the lang?
And, if this works, can I get rid of the selector without crashing the forum? (like changing it into a hidden field which worked nicely for the login form )
Willem
[moved by bozden on 01 October 2002]
< |
Edited by - Deleted on 01 October 2002 17:41:36 |
|
Deleted
deleted
    
4116 Posts |
Posted - 29 April 2002 : 10:29:42
|
quote:
Hi,
I'm testing the 4.b3 (incl. all post b3 updates) version using english & dutch. Now i'm trying to define the lang outside the forum. (my page allready uses a lang selector, so I want to open the forum using this selected lang) My page passes a var using the URL (www...com/test.asp?Lang=US )
How do I set the Lang before the forum page is loaded? (Can I set the cookie.. and how do i do that?) or should i change something in the forum pages to set the lang?
And, if this works, can I get rid of the selector without crashing the forum? (like changing it into a hidden field which worked nicely for the login form )
Willem
The forum uses the LOCALE concept, not the LANGUAGE (which is only a part of the LOCALE), but you can use them interchangeably in some cases.
The current implementation (v4b03.x) uses only the cookies to save LCID specific info. In v4b04, "forced" (through querystring as you mentioned) and user preferred (selected from member profile) will also be supported.
Let us concentrate on current implementation and your request. It's not readily cooked, but we can cook it together if you like...
Suppose the scenario is:
- You set your language from an outside selector (predefined non-Snitz)
- The language information is passed with the querystring (will not be used by forum files)
- The language selector will not be shown on forum pages
First you need to set the snitz lang cookie from your other page. You can do it like:
<% ' SET THE SNITZ LCID COOKIE DIM strTempLang, strTempLCID strTempLang = request.QueryString("LANG") select case strTempLang case "US" strTempLCID = "1033" case ".." strTempLCID = "...." 'what ever other languages ... case else strTempLCID = "...." 'to be safe if LANG is not set somehow end select
Const strUniqueID = "Snitz00" Const strCookieURL = "/forum/" ' whatever it is in your strCookieURL (see admin/Forum vars) Const strSetCookieToForum = 1 'set to 1 is cookie is set to forum
if strSetCookieToForum = 1 then Response.Cookies(strUniqueID & "Lang").Path = strCookieURL else Response.Cookies(strUniqueID & "Lang").Path = "/" end if Response.Cookies(strUniqueID & "Lang") = strTempLCID Response.Cookies(strUniqueID & "Lang").Expires = dateAdd("d", 30, now)
You also need to remove the language selector from inc_top.asp (comment out two instances)
<% 'Call LangShowLanguageSelector("") %>
I think you don't need to make any changes in config.asp...
Think Pink ==> Start Internationalization Here
edit: added expires setting...
Edited by - bozden on 30 April 2002 09:11:13< |
 |
|
wab73
Starting Member
Netherlands
6 Posts |
Posted - 29 April 2002 : 10:47:33
|
Thanks ! this will do the trick for me.
I'll check out 4b04 when it's released .. again, mucho gracias ..
< |
 |
|
Deleted
deleted
    
4116 Posts |
Posted - 29 April 2002 : 11:25:20
|
quote:
Thanks ! this will do the trick for me.
I'll check out 4b04 when it's released .. again, mucho gracias ..
You're welcome . But the above logic is not tested before. Please test it on a test site and post the results here...
Think Pink ==> Start Internationalization Here< |
 |
|
wab73
Starting Member
Netherlands
6 Posts |
Posted - 30 April 2002 : 08:03:35
|
hmm.. didn't work as planned When I select a lang on my 'other' pages, browse a bit, and then switch to the forum everything works .. but when i include my own selector on a forum page i first have to reload the page before the lang changes into the selected one. (I should have figured that before trying..) In a framed site this should work nicely though.
I'm gonna need another approach to provide my users with a selector on the forum ... I'm now thinking of using the forum cookie for passing my lang and get rid of my querystring var. It seems to be a better (looking) solution for passing vars anyway..
thanks again.
< |
 |
|
Deleted
deleted
    
4116 Posts |
Posted - 30 April 2002 : 09:05:43
|
I could not see the reason why it is not working. 1) Did you include the code into every page you have a selector? 2) Do you auto-reload the page on-change of the selector, so the code is executed? 3) Are you sure you put correct values for strCookieURL and strSetCookieToForum fields in the code given above?
If you feel comfortable to play with your other pages, why don't you just use the forum's selector?
To do this, you need to: 1) Set your cookies to website (you must have only one forum) 2) Include "config.asp" or "inc_langshort.asp" to your forum pages 3) Use "<% call LangShowLanguageSelector(strStyle) %>" to put the selector on your site pages.
I use a similar thing in http://www.istanbulmuzesi.org site...
Alternatively, you can continue to use the query string and/or hidden field method. You just call the link to the forum like
<a href="forum/default.asp?lang=1033">Forums</a>
and put a couple of lines into config.asp to first determine the "forced" parameter and set the cookie from there:
' FORCED SET LCID IN CONFIG ASP. PUT THIS JUST IN FRONT OF THE INTERNATIONALIZATION PART strTempLang = request.QueryString("LANG") if strTempLang <> "" then 'if there is a querysring set the cookie if strSetCookieToForum = 1 then Response.Cookies(strUniqueID & "Lang").Path = strCookieURL else Response.Cookies(strUniqueID & "Lang").Path = "/" end if Response.Cookies(strUniqueID & "Lang") = strTempLang Response.Cookies(strUniqueID & "Lang").Expires = dateAdd("d", 30, now) end if
A link to your site would really help for me to figure out what is happening.
Think Pink ==> Start Internationalization Here
Edited by - bozden on 30 April 2002 09:15:25< |
 |
|
Deleted
deleted
    
4116 Posts |
Posted - 30 April 2002 : 09:09:26
|
Setting an "expires" value may be needed for the cookie. I changed the codes given above to reflect these...
Think Pink ==> Start Internationalization Here< |
 |
|
wab73
Starting Member
Netherlands
6 Posts |
Posted - 30 April 2002 : 10:13:50
|
my own selector is a pic using a javascript:setlang(lang) which open the page with an adapted url. the asp part get executed after the reload. it should be before.
I like the idea of the cookie. It's a nice upodate for my site and i can use the forum with my own selector. It also gives me somthing to show off to the boss .. 
btw.. i'm developing at home so no url.. the company site has no forum yet but when it does i wil post the url ..
Edited by - wab73 on 30 April 2002 10:16:48< |
 |
|
|
Topic  |
|