473,386 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Language Change AJAX

384 256MB
I have a select option with two languages english and irish, and when the user selects one i use the onchange function to change the session language variable to the new language but the new lanaguage doesn't take effect until i refresh the current page or go to another page on the site, anyone any ideas? Is AJAX a bad idea to use for such a function?
Feb 25 '09 #1
8 5153
acoder
16,027 Expert Mod 8TB
Is the session variable a server-side variable, or do you have a JavaScript variable?

If it's server-side, Ajax would make sense, but you'll still need to update the current page.
Feb 25 '09 #2
ziycon
384 256MB
Its in PHP so its a server side variable, can i add a window.location.href or will that defeat the whole prpose of having the AJAX change the language?
Feb 25 '09 #3
acoder
16,027 Expert Mod 8TB
Yes, that would defeat the purpose. Is it necessary for it to take effect immediately? You could just trigger a page reload when the language is changed.
Feb 25 '09 #4
ziycon
384 256MB
The reload is only needed when the user selects a different language then the defaulted one!?
Feb 25 '09 #5
acoder
16,027 Expert Mod 8TB
That depends on the content. If there's a lot of content to change on the current page, perhaps it makes more sense to reload the page. If there's minimal content or you want to avoid a page reload at all costs, then you can change the content using JavaScript, though you would need Ajax to change the session variable.
Feb 26 '09 #6
ziycon
384 256MB
Yup, its all the text content on the page the user is on has to be changed! So a page reload is needed.
Feb 26 '09 #7
acoder
16,027 Expert Mod 8TB
Strictly speaking, you could just use JavaScript to change the content, but it would mean extra work while a simple reload would be just as good.
Feb 26 '09 #8
Frinavale
9,735 Expert Mod 8TB
Not sure what language you're using to implement your solution, but if you want to change the language/culture in ASP.NET you must do a full page post back to the server. It has to reset all of the controls with the new settings and the only way you can do this is to reload the whole page.

I tried doing this with Ajax once...I always have to learn the hard way.
Not only was only a section of my page updated with the new language....but things get pretty messed up because of the cultural settings....when your control is supplying your page with English - US cultural information but the culture has been set to something like French - CA........well you can image what happens (especially with dates).
Feb 27 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Garmt de Vries | last post by:
On some of my English language webpages, I have images of Dutch books. In the alt text for this image, I give the title of the book, for example: <img src="maan.jpg" alt="Cover of De reis naar...
2
by: OM | last post by:
Hi, I have a simple Access application, for recording fuel use, and generating a few reports. It is necessary that the forms (such as the menu, and data entry forms) be in Thai as well as...
4
by: Shapper | last post by:
Hello, I have this image in my HTML code: <img src="images/en-US/myImage.jpg" /> I want to change the URL using the value of a Session variable. <img src="images/ Session("culture") Value...
11
by: Bryan | last post by:
Hi, I work for a company that is heading towards an FDA approved development process. We have always used C++ in a windows environment, and we have more than 6 years of code, applications and...
2
by: nmsreddi | last post by:
hi i am using java script for my application .but latest i came to know ajax is powerful than javascript. Can any one help,which ios better scripting language ,is ajax going to replace javscript! ...
1
by: S D Manuweera | last post by:
Hi, I puchased a Sony Vaio PCG-7G1M laptop from Germany with windows XP home package in german language. I want to change the laguage to English. How can I do this. Is the facility available in...
13
pradeepjain
by: pradeepjain | last post by:
I have a form .i need this form field labels to be displayed in 3-4 languages . i have the corresponding labels in different languages in a .xml file . i dono how to do the conversions. form is in...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.