473,388 Members | 1,526 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,388 software developers and data experts.

Multilanguage Website

64
Hi folks,

I am trying to change the language of my website dinamically. So, i have created a global resource file(.resx) for each language I want to display. For example: LanguageEnUs.resx, LanguagePtBr.resx, etc...

The user would be able to switch the language whenever he wants, so I must load the .resx on his request.

I have already done it programatically using
Expand|Select|Wrap|Line Numbers
  1. globalresourcestring = (String)GetGlobalResourceObject("LanguageEnUs", "Greetings")
It works fine... but I would like to use it on my HTML tags using the expression

Expand|Select|Wrap|Line Numbers
  1. <%$ Resources:Class, ResourceID %>
as the following example:

Expand|Select|Wrap|Line Numbers
  1. <asp:Label ID="lblErrorMsg" runat="server" Text="<%$ Resources:LanguageEnUs, lblErrorsgText %>"></asp:Label>
My question is:

How do I change the static LanguageEnUs in this expression for a variable that I can recover from somewhere else? Or better... is this possible?

Thanks in advance,

Fernando Mello
Mar 23 '12 #1
1 2080
Frinavale
9,735 Expert Mod 8TB
You are currently doing more work than you need to.
If you name your resources properly, and you configure things right, you don't have to do any of this. The browser will pick up the end users' culture settings and relay that to the server. The server will automatically load the resource (that is named properly) that fits with that culture.

If you want to specifically set the language, you simply need to change the culture of the Thread.

Since the resources are loaded according to the users cultural settings before the Page Load event, if you set the culture you will need to re-request the page to load it with the correct language settings.

You'll have to save the culture settings that aren't the default settings somewhere (viewstate or session or something).

There are a lot of articles in the MSDN Library that cover the topic. Like this one: ASP.NET Globalization and Localization and this one: Walkthrough: Using Resources for Localization with ASP.NET.

-Frinny
Mar 25 '12 #2

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

Similar topics

5
by: Mariano López | last post by:
I'm trying to make a multilanguage website. When the user enters the site, I want to detect the language and automatically make a redirection. How can I do this? And how should I organize my data...
5
by: bettina | last post by:
My default language is german. It will be so defined in the main site: main.php <? $lang = 'ge'; include("set_language.php"); ?> st_language.php <?php
0
by: Giovane Calabrese | last post by:
ok. im try to make a multilanguage system based on that tutorial : http://www.123aspx.com/redir.aspx?res=29112 in my aspx pages all text are in labels , and i want to take the name labels...
1
by: Andrew Smith | last post by:
Hi, does anybody know to program multilanguage website, which are dependend on the browsers language settings? Does anybody know a nice jumpstart for this? Thanks in advance for any advice...
5
by: Michal Táborský | last post by:
I am wondering, if it's effective to use text arrays to store multilanguage information. We used to do it like this: CREATE TABLE product ( id serial NOT NULL, price float4, ... )
3
by: BLob | last post by:
Hi, I am building a multi languages website. To simplify let's say that I need to deal with news, projects, partners, all of them having some information depending on the language (title,...
15
by: AG | last post by:
I have seen the samples for multilanguage support regarding what is normally static content. Can anyone point me to a good sample for multilanguage support for dynamic content. Like a gridview...
1
by: paolob | last post by:
I need to provide multilanguage support to my application. I alredy writed a multilanguage test application, using VS6 and resource only dll. Now i'm using Visual Studio 2005, I find out that it...
1
by: schneider | last post by:
Hi all, I'm planning to create a multilanguage-capable website in asp.net 2.0, using c#. I have read some very nice articles about internationalization and localization. A common hint is using a...
1
by: mmr315 | last post by:
Hi All, This is mahesh. I am developing a site for online hotel booking. I need help in php for converting my website in to different language when user click on language the current page should...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.