HighTechTalks DotNet Forums  

Localization in Web application

Dotnet Internationalization microsoft.public.dotnet.internationalization


Discuss Localization in Web application in the Dotnet Internationalization forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
spjensen
 
Posts: n/a

Default Localization in Web application - 11-07-2005 , 10:02 AM






I have the following resource files in a VB .NET project "RESproj":
spjeRes.da.resx
spjeRes.de.resx
spjeRes.resx

The resource project is installed on a Web Server: MESSRV01.

I expect the following code to get either the Danish ("da") or the German
("de") localization from this resource project if run on a PC with regional
settings set to Danish/Denmark respectively German/Germany and otherwise fall
back to the localization in "spjeRes.resx" (which is english)

..
..
Dim ci As System.Globalization.CultureInfo =
System.Threading.Thread.CurrentThread.CurrentCultu re
Dim rm As System.Resources.ResourceManager
Dim assemb As System.Reflection.Assembly
Dim s As String


assemb =
System.Reflection.Assembly.LoadFrom("http://MESSRV01/SmartLoader/OLV/RESproj.dll")
rm = New System.Resources.ResourceManager("RESproj.spjeRes" , assemb)

Try
s = rm.GetString("House", ci)
MsgBox(s)
Catch ex As Exception
MsgBox(ex.Message)
End Try
..
..


This functions well when run on one Client PC but NOT on another.
The other Client PC falls back to the localization in "spjeRes.resx"
regardless of the regional settings of this client.

What possible causes exists for this behavior?


--
Regards
S. P. Jensen


Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default RE: Localization in Web application - 11-08-2005 , 07:41 PM






First, it appears as though you are attempting to load resources based on
the CurrentCulture property (used for data formatting) rather than
CurrentUICulture (used for resources). This is the first change I would
recommend. Second, you'll probably want to base both the culture and
resource selection based on the client computer's browser accept language
instead of the user locale setting:

' Setting CurrentCulture to specific culture, based on browser accept
language
System.Threading.Thread.CurrentThread.CurrentCultu re =
System.Globalization.CultureInfo.CreateSpecificCul ture(Request.UserLanguages
(0))

' Setting CurrentUICulture to specific culture, based on browser accept
language
System.Threading.Thread.CurrentThread.CurrentUICul ture = new
System.Globalization.CultureInfo(Request.UserLangu ages(0))

Garrett McGowan [MSFT Developer International]

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--------------------
Quote:
From: spjensen (AT) discussions (DOT) microsoft.com
Subject: Localization in Web application
Date: Mon, 7 Nov 2005 07:02:02 -0800
Newsgroups: microsoft.public.dotnet.internationalization

I have the following resource files in a VB .NET project "RESproj":
spjeRes.da.resx
spjeRes.de.resx
spjeRes.resx

The resource project is installed on a Web Server: MESSRV01.

I expect the following code to get either the Danish ("da") or the German
("de") localization from this resource project if run on a PC with
regional
settings set to Danish/Denmark respectively German/Germany and otherwise
fall
back to the localization in "spjeRes.resx" (which is english)

Dim ci As System.Globalization.CultureInfo =
System.Threading.Thread.CurrentThread.CurrentCultu re
Dim rm As System.Resources.ResourceManager
Dim assemb As System.Reflection.Assembly
Dim s As String

assemb =
System.Reflection.Assembly.LoadFrom("http://MESSRV01/SmartLoader/OLV/RESproj
..dll")
Quote:
rm = New System.Resources.ResourceManager("RESproj.spjeRes" , assemb)

Try
s = rm.GetString("House", ci)
MsgBox(s)
Catch ex As Exception
MsgBox(ex.Message)
End Try

This functions well when run on one Client PC but NOT on another.
The other Client PC falls back to the localization in "spjeRes.resx"
regardless of the regional settings of this client.

What possible causes exists for this behavior?

--
Regards
S. P. Jensen




Reply With Quote
  #3  
Old   
spjensen
 
Posts: n/a

Default RE: Localization in Web application - 11-11-2005 , 10:45 AM



Thanks for the response

I tried your recomandation regarding the use of CurrentUICulture in stead of
CurrentCulture.
The reaction was the same.
But what I really do not understand is why the code piece works on ONE
client and NOT on ANOTHER client.
I made the conclusion that it had to be incorrect settings of the second
client, but what settings influences this behavior?

--
Regards
S. P. Jensen



"Garrett McGowan[MSFT]" skrev:

Quote:
First, it appears as though you are attempting to load resources based on
the CurrentCulture property (used for data formatting) rather than
CurrentUICulture (used for resources). This is the first change I would
recommend. Second, you'll probably want to base both the culture and
resource selection based on the client computer's browser accept language
instead of the user locale setting:

' Setting CurrentCulture to specific culture, based on browser accept
language
System.Threading.Thread.CurrentThread.CurrentCultu re =
System.Globalization.CultureInfo.CreateSpecificCul ture(Request.UserLanguages
(0))

' Setting CurrentUICulture to specific culture, based on browser accept
language
System.Threading.Thread.CurrentThread.CurrentUICul ture = new
System.Globalization.CultureInfo(Request.UserLangu ages(0))

Garrett McGowan [MSFT Developer International]

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--------------------
From: spjensen (AT) discussions (DOT) microsoft.com
Subject: Localization in Web application
Date: Mon, 7 Nov 2005 07:02:02 -0800
Newsgroups: microsoft.public.dotnet.internationalization

I have the following resource files in a VB .NET project "RESproj":
spjeRes.da.resx
spjeRes.de.resx
spjeRes.resx

The resource project is installed on a Web Server: MESSRV01.

I expect the following code to get either the Danish ("da") or the German
("de") localization from this resource project if run on a PC with
regional
settings set to Danish/Denmark respectively German/Germany and otherwise
fall
back to the localization in "spjeRes.resx" (which is english)

Dim ci As System.Globalization.CultureInfo =
System.Threading.Thread.CurrentThread.CurrentCultu re
Dim rm As System.Resources.ResourceManager
Dim assemb As System.Reflection.Assembly
Dim s As String

assemb =
System.Reflection.Assembly.LoadFrom("http://MESSRV01/SmartLoader/OLV/RESproj
.dll")
rm = New System.Resources.ResourceManager("RESproj.spjeRes" , assemb)

Try
s = rm.GetString("House", ci)
MsgBox(s)
Catch ex As Exception
MsgBox(ex.Message)
End Try

This functions well when run on one Client PC but NOT on another.
The other Client PC falls back to the localization in "spjeRes.resx"
regardless of the regional settings of this client.

What possible causes exists for this behavior?

--
Regards
S. P. Jensen





Reply With Quote
  #4  
Old   
Michael \(michka\) Kaplan [MS]
 
Posts: n/a

Default Re: Localization in Web application - 11-11-2005 , 11:38 AM



Have you tried to determine what the browser accept language is from each
client?


--
MichKa [Microsoft]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Blog: http://blogs.msdn.com/michkap

This posting is provided "AS IS" with
no warranties, and confers no rights.


"spjensen" <spjensen (AT) discussions (DOT) microsoft.com> wrote

Quote:
Thanks for the response

I tried your recomandation regarding the use of CurrentUICulture in stead
of
CurrentCulture.
The reaction was the same.
But what I really do not understand is why the code piece works on ONE
client and NOT on ANOTHER client.
I made the conclusion that it had to be incorrect settings of the second
client, but what settings influences this behavior?

--
Regards
S. P. Jensen



"Garrett McGowan[MSFT]" skrev:

First, it appears as though you are attempting to load resources based on
the CurrentCulture property (used for data formatting) rather than
CurrentUICulture (used for resources). This is the first change I would
recommend. Second, you'll probably want to base both the culture and
resource selection based on the client computer's browser accept language
instead of the user locale setting:

' Setting CurrentCulture to specific culture, based on browser accept
language
System.Threading.Thread.CurrentThread.CurrentCultu re =
System.Globalization.CultureInfo.CreateSpecificCul ture(Request.UserLanguages
(0))

' Setting CurrentUICulture to specific culture, based on browser accept
language
System.Threading.Thread.CurrentThread.CurrentUICul ture = new
System.Globalization.CultureInfo(Request.UserLangu ages(0))

Garrett McGowan [MSFT Developer International]

This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--------------------
From: spjensen (AT) discussions (DOT) microsoft.com
Subject: Localization in Web application
Date: Mon, 7 Nov 2005 07:02:02 -0800
Newsgroups: microsoft.public.dotnet.internationalization

I have the following resource files in a VB .NET project "RESproj":
spjeRes.da.resx
spjeRes.de.resx
spjeRes.resx

The resource project is installed on a Web Server: MESSRV01.

I expect the following code to get either the Danish ("da") or the
German
("de") localization from this resource project if run on a PC with
regional
settings set to Danish/Denmark respectively German/Germany and otherwise
fall
back to the localization in "spjeRes.resx" (which is english)

Dim ci As System.Globalization.CultureInfo =
System.Threading.Thread.CurrentThread.CurrentCultu re
Dim rm As System.Resources.ResourceManager
Dim assemb As System.Reflection.Assembly
Dim s As String

assemb =
System.Reflection.Assembly.LoadFrom("http://MESSRV01/SmartLoader/OLV/RESproj
.dll")
rm = New System.Resources.ResourceManager("RESproj.spjeRes" , assemb)

Try
s = rm.GetString("House", ci)
MsgBox(s)
Catch ex As Exception
MsgBox(ex.Message)
End Try

This functions well when run on one Client PC but NOT on another.
The other Client PC falls back to the localization in "spjeRes.resx"
regardless of the regional settings of this client.

What possible causes exists for this behavior?

--
Regards
S. P. Jensen







Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.