473,703 Members | 4,129 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Localization: user selectable UICulture w/ UICulture = auto

Hi,

I am running into a problem of mixing UICulture = auto and allowing users to
select culture using a dropdown list.

I am detecting a querystring, "setlang", and when found, setting the
CurrentUICultur e to what's specified in the querystring. Since I want to
allow UICulture auto detecting, I add UICulture = "auto" to page directive on
each page.

Now, here is the problem: I don't know on what event (page or application) I
should set the CurrentUICultur e based on the querystring, "setlang".

Since the UICulture = "auto", I cannot utilize any of the application events
to set CurrentUICultur e. I could use PostAcquireRequ estState if UICulture is
not auto on in page directive.

I cannot use page event effectively either. I tried to set CurrentUICultur e
based on querystring in Page.PreInit. It seems that if I programmaticall y set
control's text to a resource string (textbox1.text =
resources.langu age.astring) everything works fine, but if I use explicit
binding declaratively on the control (<%$ Resources: language, astring%>), it
ignores the CurrentUICultur e set in Page.PreInit and displays the string from
the culture the page auto detects. Not being able to bind declaratively is a
produtivity killer and therefore not acceptable.

Can anyone shed some light on how I can accomplish this?
I will repeat what I want to accomplish:

1) UICulture = "auto" on page directive (or can I set it somewhere else?)
2) user selectable cultures
3) being able to bind resources to control declaratively (<%$ Resources:
language, astring%>)
Nov 19 '05 #1
5 5041
Hi Samuel,

I think the last section of this blog post can help you :
http://dotnetjunkies.com/WebLog/anor.../13/54271.aspx

Let me know if you have any more questions..

Cheers,
Tom Pester
Hi,

I am running into a problem of mixing UICulture = auto and allowing
users to select culture using a dropdown list.

I am detecting a querystring, "setlang", and when found, setting the
CurrentUICultur e to what's specified in the querystring. Since I want
to allow UICulture auto detecting, I add UICulture = "auto" to page
directive on each page.

Now, here is the problem: I don't know on what event (page or
application) I should set the CurrentUICultur e based on the
querystring, "setlang".

Since the UICulture = "auto", I cannot utilize any of the application
events to set CurrentUICultur e. I could use PostAcquireRequ estState if
UICulture is not auto on in page directive.

I cannot use page event effectively either. I tried to set
CurrentUICultur e based on querystring in Page.PreInit. It seems that
if I programmaticall y set control's text to a resource string
(textbox1.text = resources.langu age.astring) everything works fine,
but if I use explicit binding declaratively on the control (<%$
Resources: language, astring%>), it ignores the CurrentUICultur e set
in Page.PreInit and displays the string from the culture the page auto
detects. Not being able to bind declaratively is a produtivity killer
and therefore not acceptable.

Can anyone shed some light on how I can accomplish this? I will repeat
what I want to accomplish:

1) UICulture = "auto" on page directive (or can I set it somewhere
else?)
2) user selectable cultures
3) being able to bind resources to control declaratively (<%$
Resources:
language, astring%>)

Nov 19 '05 #2
Hi Tom,

Thanks for your reply. Actually what's in the blog is what I did in my code
already. The only difference is that he uses PreRequestHandl erExecute and I
used PostAcquireRequ estState (no difference)

However, I found the solution: if you want uiculture=auto while still
allowing user to change uiculture, the only way is to set uiculture = auto in
web.config and not on the page. When uiculture = auto is set in web.config,
we can use application event to override it, but when uiculture=auto is set
in page directive, you cannot override it for declaratively bound resources.

"To************ ********@pandor a.be" wrote:
Hi Samuel,

I think the last section of this blog post can help you :
http://dotnetjunkies.com/WebLog/anor.../13/54271.aspx

Let me know if you have any more questions..

Cheers,
Tom Pester
Hi,

I am running into a problem of mixing UICulture = auto and allowing
users to select culture using a dropdown list.

I am detecting a querystring, "setlang", and when found, setting the
CurrentUICultur e to what's specified in the querystring. Since I want
to allow UICulture auto detecting, I add UICulture = "auto" to page
directive on each page.

Now, here is the problem: I don't know on what event (page or
application) I should set the CurrentUICultur e based on the
querystring, "setlang".

Since the UICulture = "auto", I cannot utilize any of the application
events to set CurrentUICultur e. I could use PostAcquireRequ estState if
UICulture is not auto on in page directive.

I cannot use page event effectively either. I tried to set
CurrentUICultur e based on querystring in Page.PreInit. It seems that
if I programmaticall y set control's text to a resource string
(textbox1.text = resources.langu age.astring) everything works fine,
but if I use explicit binding declaratively on the control (<%$
Resources: language, astring%>), it ignores the CurrentUICultur e set
in Page.PreInit and displays the string from the culture the page auto
detects. Not being able to bind declaratively is a produtivity killer
and therefore not acceptable.

Can anyone shed some light on how I can accomplish this? I will repeat
what I want to accomplish:

1) UICulture = "auto" on page directive (or can I set it somewhere
else?)
2) user selectable cultures
3) being able to bind resources to control declaratively (<%$
Resources:
language, astring%>)


Nov 19 '05 #3
Hi Samuel,

I've also got the result you mentioned on my local enviornment.
=============== ==
if you want uiculture=auto while still
allowing user to change uiculture, the only way is to set uiculture = auto
in
web.config and not on the page. When uiculture = auto is set in web.config,
we can use application event to override it, but when uiculture=auto is set
in page directive, you cannot override it for declaratively bound resources.
=============== =

I think the difference between the UICulture in @page directive and
web.config maybe the @Page directive's setting will be forced in some
internal time during the page's processing which makes our adjusting in
application level event be overrided. Anyway, IMO, we'd recommend that we
avoiding using the "Auto" setting together with custom culture handling ,
thus there will exist no such potiential conflict.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Localization: user selectable UICulture w/ UICulture = auto
| thread-index: AcWavK9UvxFPttT ERyG0bfUj0lZGdw ==
| X-WBNR-Posting-Host: 64.180.16.145
| From: =?Utf-8?B?U2FtdWVs?= <pr********@nos pam.nospam>
| References: <0D************ *************** *******@microso ft.com>
<a1************ **************@ news.microsoft. com>
| Subject: Re: Localization: user selectable UICulture w/ UICulture = auto
| Date: Sat, 6 Aug 2005 12:26:03 -0700
| Lines: 64
| Message-ID: <EB************ *************** *******@microso ft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1165 15
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Hi Tom,
|
| Thanks for your reply. Actually what's in the blog is what I did in my
code
| already. The only difference is that he uses PreRequestHandl erExecute and
I
| used PostAcquireRequ estState (no difference)
|
| However, I found the solution: if you want uiculture=auto while still
| allowing user to change uiculture, the only way is to set uiculture =
auto in
| web.config and not on the page. When uiculture = auto is set in
web.config,
| we can use application event to override it, but when uiculture=auto is
set
| in page directive, you cannot override it for declaratively bound
resources.
|
| "To************ ********@pandor a.be" wrote:
|
| > Hi Samuel,
| >
| > I think the last section of this blog post can help you :
| > http://dotnetjunkies.com/WebLog/anor.../13/54271.aspx
| >
| > Let me know if you have any more questions..
| >
| > Cheers,
| > Tom Pester
| >
| > > Hi,
| > >
| > > I am running into a problem of mixing UICulture = auto and allowing
| > > users to select culture using a dropdown list.
| > >
| > > I am detecting a querystring, "setlang", and when found, setting the
| > > CurrentUICultur e to what's specified in the querystring. Since I want
| > > to allow UICulture auto detecting, I add UICulture = "auto" to page
| > > directive on each page.
| > >
| > > Now, here is the problem: I don't know on what event (page or
| > > application) I should set the CurrentUICultur e based on the
| > > querystring, "setlang".
| > >
| > > Since the UICulture = "auto", I cannot utilize any of the application
| > > events to set CurrentUICultur e. I could use PostAcquireRequ estState if
| > > UICulture is not auto on in page directive.
| > >
| > > I cannot use page event effectively either. I tried to set
| > > CurrentUICultur e based on querystring in Page.PreInit. It seems that
| > > if I programmaticall y set control's text to a resource string
| > > (textbox1.text = resources.langu age.astring) everything works fine,
| > > but if I use explicit binding declaratively on the control (<%$
| > > Resources: language, astring%>), it ignores the CurrentUICultur e set
| > > in Page.PreInit and displays the string from the culture the page auto
| > > detects. Not being able to bind declaratively is a produtivity killer
| > > and therefore not acceptable.
| > >
| > > Can anyone shed some light on how I can accomplish this? I will repeat
| > > what I want to accomplish:
| > >
| > > 1) UICulture = "auto" on page directive (or can I set it somewhere
| > > else?)
| > > 2) user selectable cultures
| > > 3) being able to bind resources to control declaratively (<%$
| > > Resources:
| > > language, astring%>)
| >
| >
| >
|

Nov 19 '05 #4
Thanks Steven for your reply. Yes, I think the same too, but I also think
that being able to auto select UIculture for users while allowing them to
choose ui is a very nice feature if you want pefect globalization for your
app. Thus, setting UICulture = auto in web.config seems like a good solution
to me.. are you telling me you are afraid that in the future this behavior
could change?

By the way, can you please check out this new thread of mine, titled

"reference web control in dynamically added user control, ASP.NET 2"

I am not sure how I can send you directly the URL to the post, but you
should be able to see it on the first page of this newsgroup.

Thanks in advance!
Nov 19 '05 #5
Thanks for your prompt response Samuel,

En, yes, though I'm not absolutely sure whether this is changable through
different version, but since its a undocumented behavior, generally we can
not guarantee it. Anyway, I think its ok that you leave it as you currently
do.

In addition, as for the new thread you mentioned, did you just post it
right now? If so, maybe it hasn't been synchornized to our internal
program, I also search it on google and didn't find it. I'll monitor it
later. In addition, for asp.net 2.0 issue, we also suggest you try posting
in the

http://forums.microsoft.com/msdn/default.aspx

msdn forum since sometimes there have some .net dev team's members there.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: Localization: user selectable UICulture w/ UICulture = auto
| thread-index: AcWb7IYdiCzNB71 iQhCmuDCyCAh4fg ==
| X-WBNR-Posting-Host: 64.180.16.145
| From: =?Utf-8?B?U2FtdWVs?= <pr********@nos pam.nospam>
| References: <0D************ *************** *******@microso ft.com>
<a1************ **************@ news.microsoft. com>
<EB************ *************** *******@microso ft.com>
<BQ************ **@TK2MSFTNGXA0 1.phx.gbl>
| Subject: Re: Localization: user selectable UICulture w/ UICulture = auto
| Date: Mon, 8 Aug 2005 00:41:01 -0700
| Lines: 15
| Message-ID: <6C************ *************** *******@microso ft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.p hx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.p hx.gbl!TK2MSFTN GXA03.phx.gbl
| Xref: TK2MSFTNGXA01.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:1166 30
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Thanks Steven for your reply. Yes, I think the same too, but I also think
| that being able to auto select UIculture for users while allowing them to
| choose ui is a very nice feature if you want pefect globalization for
your
| app. Thus, setting UICulture = auto in web.config seems like a good
solution
| to me.. are you telling me you are afraid that in the future this
behavior
| could change?
|
| By the way, can you please check out this new thread of mine, titled
|
| "reference web control in dynamically added user control, ASP.NET 2"
|
| I am not sure how I can send you directly the URL to the post, but you
| should be able to see it on the first page of this newsgroup.
|
| Thanks in advance!
|

Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1712
by: Paul M | last post by:
Hi there, can anyone help me with this one.... i have a page which is in normal english format, but when i wanna change it to Russian format text, i set the Culture code, but it still remains the same. Does this mean that every bit of text i need to convert every label on my screens in order for them to show or is there an easier way to this? thanks for anybody's help.
8
2539
by: Olivier Matrot | last post by:
I encounter a problem with Localization features in ASP.NET 2.0. Is seems that the framework is not able to manage neutral cultures such as 'fr', or 'de'. Those are the culture sent by default from a french or German Internet Explorer in France or Germany. There is a runtime error "System.NotSupportedException: Culture "fr" is a neutral culture. It can not be used in formatting and parsing and therefore cannot be set as the thread's...
1
1174
by: kelmen | last post by:
Greeting, I'm working on the resources stuff, using the explicit localization. And to test it is as : http://www.asp.net/QuickStart/aspnet/doc/localization/culture.aspx#ielanguage add in the desired language and move to top, in the IE - Tool - Option - Language. how this doesn't work. My still showing english (expecting Chinese).
5
6201
by: Mikeon | last post by:
Hello! I have tried to localize my Web.sitemap file using implicit localization but it doesn't seem to work. What I have done until now: I have created a sample Web.sitemap file: <?xml version="1.0" encoding="utf-8" ?>
1
397
by: Bruno Alexandre | last post by:
Hi Guys, I'm driving crazy here with Localization issue, this is what I have now: masterpage.master - with some asp:linkbutton like this: <asp:LinkButton PostBackUrl="~/login/Default.aspx" ID="lnkLogout" runat="server" Text="<%$ Resources:language, menu_logout %>" />
4
2002
by: Claes Bergefall | last post by:
I would like to format dates etc in the format that the user browsing the page would prefer according to his language setting. The DateTimeFormatInfo class provides all the information I need, but how do I get an instance of it (or something else that has the info)? Using DateTimeFormatInfo.Current doesn't work. It gives me the server settings. Using HttpRequest.UserLanguages to create a culture doesn't work either. The language I get...
2
1328
by: TVDJR | last post by:
Hi, I haven't had much luck in finding anything on this subject matter. I have a decent understanding of localization techinques but am not quite sure about some of the more simple things related to it. For example, say a user is in china, do they enter the english version of the url to go to the site? Say www.mysite.cn ? or do they enter the url with chinese characters? Can i read and write a cookie to their system using a english value...
0
1642
by: shapper | last post by:
Hello, Sometime ago I followed an article (I believe MSDN) related with localization in Asp.Net 2.0. To make pages localization I create a class named Localization: 1 Public Class _Localization 2 Inherits Page 3
0
1944
by: nickmarkham | last post by:
Hi, I have 'localized' the button images in my web app by using an HTTP handler file for each image so the correct langauge imagebutton can be loaded depending on the users language. In the ASHX file, i set the CurrentUICulture for the current thread using the following line, which reads the users' broswer default langauge. This works fine. Thread.CurrentThread.CurrentUICulture = New CultureInfo(context.Request.UserLanguages(0)) ...
0
8761
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8674
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
7876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5923
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4434
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3127
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2463
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2070
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.