Hi,
I've created a class library assembly containing several string resource
files, like:
- TableColumns.re sx
- TableColumns.de .resx
- General.resx
- General.de.resx
I don't know how to address each of these having automatic language
fall-back enabled.
If I write...
new
ResourceManager ("TableColumns" ,...GetExecutin gAssembly()).Ge tString("someID ");
....I always only get strings from TableColumns.re sx, but not from
TableColumns.de .resx, although CurrentCulture. Name yields "Germany".
What am I doing wrong?
TIA,
Axel Dahmen 5 9447
Hi Axel,
For the resource retrieving question you mentioned, it is due to the
"ResourceManage r.GetString" has two versions, one take a single string
input parameter which will retrieve the resource string depend on your
application's current Culture setting. This can be configured by setting
currrent Thread's UICulture. e.g.
=========
//set the UICulture first
CultureInfo culture = new CultureInfo("de-De");
System.Threadin g.CurrentThread .CurrentUICultu re = culture;
//use ResourceManager to retrieve string
========
the following article also mention this:
#Internationali ze Your ASP.NET Applications (Part 2 of 3) http://www.devx.com/dotnet/Article/6999
Or if you want to supply the CultureInfo(det ermine which culture specific)
when loading the resource item, you can use another signature of the
"GetString" method:
#ResourceManage r.GetString Method (String, CultureInfo) http://msdn2.microsoft.com/en-us/lib...55(VS.71).aspx
therefore, the resource loading is depend on the second "CultureInf o"
parameter instance.
Here are some other reference on .NET localization:
#Resources in Applications http://msdn2.microsoft.com/en-us/lib...5x(VS.71).aspx
#Resources and Localization Using the .NET Framework SDK http://msdn2.microsoft.com/en-us/lib...21(VS.71).aspx
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
=============== =============== =============== =====
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?QXhlbCBEYWh tZW4=?= <ke********@new sgroup.nospam> Subject: Resources: How to retrieve localized resource? Date: Fri, 30 Nov 2007 03:06:01 -0800
> Hi,
I've created a class library assembly containing several string resource files, like:
- TableColumns.re sx - TableColumns.de .resx - General.resx - General.de.resx
I don't know how to address each of these having automatic language fall-back enabled.
If I write...
new ResourceManage r("TableColumns ",...GetExecuti ngAssembly()).G etString("someI D
");
> ...I always only get strings from TableColumns.re sx, but not from TableColumns.d e.resx, although CurrentCulture. Name yields "Germany".
What am I doing wrong?
TIA, Axel Dahmen
Hi Steven,
thanks for your reply.
As you can see from my original posting I've been using the one-parameter version of GetString(). Still it's just getting the neutral version. Is there anything wrong with my code below?
AFAIK, .NET 2.0 (in contrast to .NET 1.0) automatically sets the current thread's CurrentCulture property. Am I wrong with this assumption?
TIA,
Axel Dahmen
--------------------
"Steven Cheng[MSFT]" <st*****@online .microsoft.coms chrieb im Newsbeitrag news:mI******** ******@TK2MSFTN GHUB02.phx.gbl. ..
Hi Axel,
For the resource retrieving question you mentioned, it is due to the
"ResourceManage r.GetString" has two versions, one take a single string
input parameter which will retrieve the resource string depend on your
application's current Culture setting. This can be configured by setting
currrent Thread's UICulture. e.g.
=========
//set the UICulture first
CultureInfo culture = new CultureInfo("de-De");
System.Threadin g.CurrentThread .CurrentUICultu re = culture;
//use ResourceManager to retrieve string
========
the following article also mention this:
#Internationali ze Your ASP.NET Applications (Part 2 of 3) http://www.devx.com/dotnet/Article/6999
Or if you want to supply the CultureInfo(det ermine which culture specific)
when loading the resource item, you can use another signature of the
"GetString" method:
#ResourceManage r.GetString Method (String, CultureInfo) http://msdn2.microsoft.com/en-us/lib...55(VS.71).aspx
therefore, the resource loading is depend on the second "CultureInf o"
parameter instance.
Here are some other reference on .NET localization:
#Resources in Applications http://msdn2.microsoft.com/en-us/lib...5x(VS.71).aspx
#Resources and Localization Using the .NET Framework SDK http://msdn2.microsoft.com/en-us/lib...21(VS.71).aspx
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
=============== =============== =============== =====
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: =?Utf-8?B?QXhlbCBEYWh tZW4=?= <ke********@new sgroup.nospam>
Subject: Resources: How to retrieve localized resource?
Date: Fri, 30 Nov 2007 03:06:01 -0800
Hi,
I've created a class library assembly containing several string resource
files, like:
- TableColumns.re sx
- TableColumns.de .resx
- General.resx
- General.de.resx
I don't know how to address each of these having automatic language
fall-back enabled.
If I write...
new
ResourceManager ("TableColumns" ,...GetExecutin gAssembly()).Ge tString("someID
");
...I always only get strings from TableColumns.re sx, but not from
TableColumns.de .resx, although CurrentCulture. Name yields "Germany".
What am I doing wrong?
TIA,
Axel Dahmen
Perhaps the source code might help finding the problem. Here's the (test) code:
---------
string str;
str = System.Threadin g.Thread.Curren tThread.Current Culture.ToStrin g(); //
yields "de-DE"
str = new
ResourceManager ("MyProject.Cla sses.Ressources .TableColumns", System.Reflecti on.Assembly.Get ExecutingAssemb ly()).GetString (tableName
+ "." + columnName); // erroneously yields an English expression
System.Threadin g.Thread.Curren tThread.Current Culture = new
System.Globaliz ation.CultureIn fo("de-DE");
str = new
ResourceManager ("MyProject.Cla sses.Ressources .TableColumns", System.Reflecti on.Assembly.Get ExecutingAssemb ly()).GetString (tableName
+ "." + columnName); // still yields an English expression
---------
Both, class and resource files reside in a class library project
("MyProject.Cla sses") in a folder called "Ressources ":
MyProject.Class es
|-- Ressources
|-- GetMultiLanguag eTexts.cs
|-- TableColumns.de .resx
|-- TableColumns.re sx
|-- ...
Hi Steven,
I've found out what the problem was (or is):
ASP.NET doesn't automatically add the UICulture="auto " attribute to the
@Page directive. I needed to add this attribute manually.
Strange, but here we go... Now everything works as expected.
Thanks again for trying to help.
Best regards, www.axeldahmen.de
Axel Dahmen
--------------------
"Steven Cheng[MSFT]" wrote:
Hi Axel,
For the resource retrieving question you mentioned, it is due to the
"ResourceManage r.GetString" has two versions, one take a single string
input parameter which will retrieve the resource string depend on your
application's current Culture setting. This can be configured by setting
currrent Thread's UICulture. e.g.
=========
//set the UICulture first
CultureInfo culture = new CultureInfo("de-De");
System.Threadin g.CurrentThread .CurrentUICultu re = culture;
//use ResourceManager to retrieve string
========
the following article also mention this:
#Internationali ze Your ASP.NET Applications (Part 2 of 3) http://www.devx.com/dotnet/Article/6999
Or if you want to supply the CultureInfo(det ermine which culture specific)
when loading the resource item, you can use another signature of the
"GetString" method:
#ResourceManage r.GetString Method (String, CultureInfo) http://msdn2.microsoft.com/en-us/lib...55(VS.71).aspx
therefore, the resource loading is depend on the second "CultureInf o"
parameter instance.
Here are some other reference on .NET localization:
#Resources in Applications http://msdn2.microsoft.com/en-us/lib...5x(VS.71).aspx
#Resources and Localization Using the .NET Framework SDK http://msdn2.microsoft.com/en-us/lib...21(VS.71).aspx
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
=============== =============== =============== =====
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: =?Utf-8?B?QXhlbCBEYWh tZW4=?= <ke********@new sgroup.nospam>
Subject: Resources: How to retrieve localized resource?
Date: Fri, 30 Nov 2007 03:06:01 -0800
Hi,
I've created a class library assembly containing several string resource
files, like:
- TableColumns.re sx
- TableColumns.de .resx
- General.resx
- General.de.resx
I don't know how to address each of these having automatic language
fall-back enabled.
If I write...
new
ResourceManager ("TableColumns" ,...GetExecutin gAssembly()).Ge tString("someID
");
...I always only get strings from TableColumns.re sx, but not from
TableColumns.de .resx, although CurrentCulture. Name yields "Germany".
What am I doing wrong?
TIA,
Axel Dahmen
Thanks for your reply Axel,
Glad that you've figured it out. BTW, I haven't expected that your code is
used in ASP.NET web app context and assumed that you used it in winform
app. That's why I just ask you check the Thread's Current Culture settings.
Thanks again for posting!
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?QXhlbCBEYWh tZW4=?= <ke********@new sgroup.nospam> References: <58************ *************** *******@microso ft.com>
<mI************ **@TK2MSFTNGHUB 02.phx.gbl>
>Subject: RE: Resources: How to retrieve localized resource? Date: Tue, 4 Dec 2007 11:05:00 -0800
>Hi Steven,
I've found out what the problem was (or is):
ASP.NET doesn't automatically add the UICulture="auto " attribute to the @Page directive. I needed to add this attribute manually.
Strange, but here we go... Now everything works as expected.
Thanks again for trying to help.
Best regards, www.axeldahmen.de Axel Dahmen
-------------------- "Steven Cheng[MSFT]" wrote:
>Hi Axel,
For the resource retrieving question you mentioned, it is due to the "ResourceManag er.GetString" has two versions, one take a single string input parameter which will retrieve the resource string depend on your application' s current Culture setting. This can be configured by setting currrent Thread's UICulture. e.g.
========= //set the UICulture first CultureInfo culture = new CultureInfo("de-De"); System.Threadi ng.CurrentThrea d.CurrentUICult ure = culture;
//use ResourceManager to retrieve string ========
the following article also mention this:
#International ize Your ASP.NET Applications (Part 2 of 3) http://www.devx.com/dotnet/Article/6999
Or if you want to supply the CultureInfo(det ermine which culture
specific)
>when loading the resource item, you can use another signature of the "GetString" method:
#ResourceManag er.GetString Method (String, CultureInfo) http://msdn2.microsoft.com/en-us/lib...55(VS.71).aspx
therefore, the resource loading is depend on the second "CultureInf o" parameter instance.
Here are some other reference on .NET localization:
#Resources in Applications http://msdn2.microsoft.com/en-us/lib...5x(VS.71).aspx
#Resources and Localization Using the .NET Framework SDK http://msdn2.microsoft.com/en-us/lib...21(VS.71).aspx
Hope this helps.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead ============== =============== =============== ======
Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscripti...ult.aspx#notif
>ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent
issues
>where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each
follow
>up response may take approximately 2 business days as the support professional working with you may need further investigation to reach
the
>most efficient resolution. The offering is not appropriate for
situations
>that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are
best
>handled working with a dedicated Microsoft Support Engineer by
contacting
>Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscripti...t/default.aspx.
============== =============== =============== ======
This posting is provided "AS IS" with no warranties, and confers no
rights.
>>
--------------------
>From: =?Utf-8?B?QXhlbCBEYWh tZW4=?= <ke********@new sgroup.nospam> Subject: Resources: How to retrieve localized resource? Date: Fri, 30 Nov 2007 03:06:01 -0800
> Hi,
I've created a class library assembly containing several string
resource
>files, like:
- TableColumns.re sx - TableColumns.de .resx - General.resx - General.de.resx
I don't know how to address each of these having automatic language fall-back enabled.
If I write...
new
ResourceManage r("TableColumns ",...GetExecuti ngAssembly()).G etString("someI D
>");
> ...I always only get strings from TableColumns.re sx, but not from TableColumns.d e.resx, although CurrentCulture. Name yields "Germany".
What am I doing wrong?
TIA, Axel Dahmen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Marcus Ahlberg |
last post by:
I've been coding a C# project in "pure code" and I would now want to import
it into VS.net. I have created a project and imported all sourcefiles and
it's compiling without problems, except for the resources. Before, I built
the program using a batchfile and linked the resources with the
"/resource:MainFrame.resX" option. Then I loaded them with this code:
Assembly myAssembly = Assembly.GetAssembly(this.GetType());
Stream resXStream =...
|
by: Fredrik Melin |
last post by:
Hi,
How can I load a localized resource file without changing the UI culture?
Sample:
System is running in English (default) but I want to create a
System.Resource.ResourceManager and load a Strings.sv file with swedish
strings.
|
by: Mythran |
last post by:
I wrote some code that is supposed to enumerate through the specified file's
win32 resources and return a string-array of all icon names. When it runs,
it returns a string-array with a bunch of numbers in sequential order (1-55
when ran against iexplore.exe).
When I open up iexplore.exe in Visual Studio, I see 23 icons. Each icon has
1 or more sizes of the icon...I'm assuming that there are, in fact, 55 icon
resources in iexplore.exe,...
|
by: vcmkrishnan.techie |
last post by:
Hi All
In C#, how can I use localized resource files in class library so that
localized error messages can be loaded in a console application
Thanks Mohan
|
by: Shimon Sim |
last post by:
I just started trying localization for my web application.
I have class library as part of solution so I need to globalize / localize
this component too.
I created resource file in the assembly itself - Account.resx - the one that
VS offers.
And wrote code like this.
static ResourceManager stringManager=
| |
by: cold80 |
last post by:
I'm trying to understand how VS 2005 and the .NET Framework 2.0 can be
used for a localized application. I've read a lot of messages, posts
and guides but I can find a straight answer. I would like to write a
DLL library, but I think it'll contain also some forms. I'd like to add
a global resx file for all the error messages and a resource file for
each form. This can be done very easily with VS2005. Then I can add a
resource file for each...
|
by: Chukkalove |
last post by:
I originally created several "copy" resource reader classes which worked
great individually, but after I converted them into an parent class with
children they no longer find the resources. Each project contains its own
reader class and resource .resx file from where a string or image is read.
Can someone tell me what I need to do to get them to work please. I attach
code.
Im not sure if it's because the derived classes are in...
|
by: Nickneem |
last post by:
I have a multilanguage project, the neutral language is English
(United States), and I added a dutch resource file Resources.nl.resx
to the project.
The forms are localizable too, e.g. there's a frmMainForm.nl.resx.
I use the Dotfuscator Community Edition and excluded all items in the
project.My namespace from renaming.
The problem is when I run the application with dutch regional settings
my strings, messageboxes, error messages, etc...
|
by: Peter Hartlén |
last post by:
I understand that the\n and \r only means something to the C# compiler so
when retrieving a line like "Hello\r\nWorld" from a resource file (localized
form or self made resource file), it prints the text as just like it was
written.
Is there any easy way to introduce a newline (tab etc.) into a string
retrieved from a resource file? Or should I create a resource string for
each line?
Thanks,
|
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...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |