.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 22nd, 2012, 10:36 PM
jasonpaulweber jasonpaulweber is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2012
Location: Detroit area, MI
Posts: 5 jasonpaulweber User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 10 sec
Reputation Power: 0
Send a message via Yahoo to jasonpaulweber Send a message via Skype to jasonpaulweber
Facebook Orkut
Have .resx files done, need entire website localized,

Localized so that, when a client goes to the website, they have the option to click on a flag and view the entire website in that language.

Using: Visual Studio 2010 / asp.net 4.0 / vb - I am NOT a programmer, just made my company's website using the above

I learned how to create a drop-down box to go to my language translation for that page, but that page only. When you go to the next, you'd have select from the drop down box all over again. I have 6 languages and all the .resx files in apps_globalresources directory.

I want them to be able to click a flag in the beginning, and view the entire website in their desired language. Is this simple, considering all I've done, or is this complex? Any guidance would be sincerely appreciated!

Jason Weber

Reply With Quote
  #2  
Old January 28th, 2012, 08:32 PM
Ronster Ronster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Location: Charlotte
Posts: 412 Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 2 h 6 m 13 sec
Reputation Power: 143
Quote:
Originally Posted by jasonpaulweber
Localized so that, when a client goes to the website, they have the option to click on a flag and view the entire website in that language.

Using: Visual Studio 2010 / asp.net 4.0 / vb - I am NOT a programmer, just made my company's website using the above

I learned how to create a drop-down box to go to my language translation for that page, but that page only. When you go to the next, you'd have select from the drop down box all over again. I have 6 languages and all the .resx files in apps_globalresources directory.

I want them to be able to click a flag in the beginning, and view the entire website in their desired language. Is this simple, considering all I've done, or is this complex? Any guidance would be sincerely appreciated!

Jason Weber


Dude... you're totally there.

You need to set the selection from that first page into a SESSION VARIABLE. That variable would then be available on the other pages, to see what language they had chosen.

Session variables are one of the typical choices to retain state across a web app.

Looks something like this:

In the page where they make their choice, you would say:

Code:
Session["Language"] = selectedLanguage;

where selectedLanguage is what they chose in the list.

In the other pages, to access that you could say:

Code:
languageChosen = Session["Language"].ToString();

(not sure if the .ToString() is needed there, pretty sure it is).


You can have multiple Session variables. You just use the [] (in C# at least), and then name the Session variable in the quotes. That Session variable is available to that user as long as their Session is valid (is lost if Session times out or something).

Good stuff.

Reply With Quote
  #3  
Old January 31st, 2012, 09:17 AM
jasonpaulweber jasonpaulweber is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2012
Location: Detroit area, MI
Posts: 5 jasonpaulweber User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 10 sec
Reputation Power: 0
Send a message via Yahoo to jasonpaulweber Send a message via Skype to jasonpaulweber
Facebook Orkut
Thank you -- site translating for entire session!

Hey, thanks for taking the time to respond, Ronster. I used what you had given me in your response, and just did a trial-and-error thing, upload, refresh, edit, upload, refresh, etc., etc., and finally got it to work! My site is now up to 8 languages and the end-user can select their own language and it lasts the entire session.

The only thing where I don't know if I'm wrong, is that the URL stays the same. I mean, like, if they're on ussvision.com/about.aspx, and they select another language, say, German, it puts the text in German, which is fine by me, but it doesn't change the URL, to, say, for instance, ussvision.com/DE/about.aspx or ussvision.com/about.aspx?lang=de or anything. I don't know if that's bad, or if I should look into rewriting that, or if I can leave it as is.

Nevertheless, thank you very much for taking the time to help. I appreciate it very much!

Jason Weber

Quote:
Originally Posted by Ronster
Dude... you're totally there.

You need to set the selection from that first page into a SESSION VARIABLE. That variable would then be available on the other pages, to see what language they had chosen.

Session variables are one of the typical choices to retain state across a web app.

Looks something like this:

In the page where they make their choice, you would say:

Code:
Session["Language"] = selectedLanguage;

where selectedLanguage is what they chose in the list.

In the other pages, to access that you could say:

Code:
languageChosen = Session["Language"].ToString();

(not sure if the .ToString() is needed there, pretty sure it is).


You can have multiple Session variables. You just use the [] (in C# at least), and then name the Session variable in the quotes. That Session variable is available to that user as long as their Session is valid (is lost if Session times out or something).

Good stuff.

Reply With Quote
  #4  
Old February 1st, 2012, 10:37 AM
Ronster Ronster is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2007
Location: Charlotte
Posts: 412 Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level)Ronster User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 5 Days 2 h 6 m 13 sec
Reputation Power: 143
Quote:
Originally Posted by jasonpaulweber
Hey, thanks for taking the time to respond, Ronster. I used what you had given me in your response, and just did a trial-and-error thing, upload, refresh, edit, upload, refresh, etc., etc., and finally got it to work! My site is now up to 8 languages and the end-user can select their own language and it lasts the entire session.

The only thing where I don't know if I'm wrong, is that the URL stays the same. I mean, like, if they're on ussvision.com/about.aspx, and they select another language, say, German, it puts the text in German, which is fine by me, but it doesn't change the URL, to, say, for instance, ussvision.com/DE/about.aspx or ussvision.com/about.aspx?lang=de or anything. I don't know if that's bad, or if I should look into rewriting that, or if I can leave it as is.

Nevertheless, thank you very much for taking the time to help. I appreciate it very much!

Jason Weber


Glad that helped, and you have it working. As for the URL bit... you didn't mention URL changing in your original post, so I didn't address that. Is it required for implementing multi-language support? Certainly not, as you've already demonstrated. Where that might help though, is being able to generate a BOOKMARKED url that could be saved (or emailed to someone) that would automatically call up the page with chosen language without user having to select it?

Quote:
ussvision.com/about.aspx?lang=de


This would be an EASY change, and an *alternative* (or an addition) to the Session implementation.

the ?lang=de part is a "query string". You could pass that to each additional page, and page logic could parse that from the URL in order to know which language to use.

Just google .net query string
https://www.google.com/search?query=.net+query+strings

The first hit is:
http://www.codeproject.com/Articles/5876/Passing-variables-between-pages-using-QueryString

and gives a good example. In your case, the variable you want to be passing is the chosen language. This would be very helpful, as if I was a German user, and I wanted to email that page to a friend... if it included the ?lang=DE part, then the page would load automatically in German.

This:
Quote:
ussvision.com/DE/about.aspx


is possibly more complicated? It presumes that you have a FOLDER for each language, with an about.aspx page in each one. You could implement a process which adds the language into the URL for each implemented language, assuming you have all the files there.

If you're able to associate your .resx files without having to do that, it makes it much easier than creating multiple folders, having multiple copies of the same file... ugh.

I like the ?lang=DE approach better. You might still want a session variable, where you check to see if it is set, and if so use that. If NOT set, you parse the URL to see if query string is used and if so set session variable to that....
Comments on this post
bunker17 agrees: Thats some descriptive help

Last edited by Ronster : February 1st, 2012 at 10:43 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > Have .resx files done, need entire website localized,

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap