473,564 Members | 2,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Localization

I need to localize my ASP.NET app and I just used "Tools" --"generate local
resources" command and everything works fine in my WebForms.
Resource file name is: MyWebForm.aspx. resx under a subDir named:
"App_LocalResou rces" inside the App directory.

Now I need to localize some messages my VB app sends to the user. What I'm
looking for is a way to read from a .resx file and get the appropriate
values.

I found some examples like this one:

Dim res As System.Resource s.ResourceManag er
res = New System.Resource s.ResourceManag er("ResFilename ",
System.Reflecti on.Assembly.Get ExecutingAssemb ly)
Myname = res.GetString(" Myname")

But when I try it, I get this error message:

Could not find any resources appropriate for the specified culture or the
neutral culture. Make sure "ResFilename.re sources" was correctly embedded or
linked into assembly "App_Web_fq5sjq k2" at compile time, or that all the
satellite assemblies required are loadable and fully signed.

The file is under the same subDir like others and is named:
ResFilename.res ources.resx

--
bruno
Jul 30 '06 #1
2 3556
Hello Bruno,

Since you mentioned that you've created local page resources through the
"Tools" --"generate local resources" menu, I think you're developing
ASP.NET 2.0 application in VS 2005. As for ASP.NET 2.0 web application, it
has provided much enhanced localization features that facilitate your work
for page localization. You have the following options to perform page
localization in ASP.NET 2.0:
1. Use local resource( in the App_LocalResour ces subdir), declaratively or
programmaticall y. And the resource items for a certain page
must be put in that page's local resource file ----- PageName.aspx.r esx

e.g. "Button1.Te xt" is a resource item's key in the page's local resource
file(in App_LocalResour ces sub folder)

<asp:Button ID="Button1" runat="server"
Text="<%$ Resources:Butto n1.Text %>" />

or
==============
protected void Page_Load(objec t sender, EventArgs e)
{
Button1.Text =
this.GetLocalRe sourceObject("B utton1.Text").T oString();
}
==============
2. Use global resource (in the App_GlobalResou rces global folder).
"App_GlobalReso urces" folder is one of the special application level
folders in ASP.NET 2.0 application which is used to store some application
scope resources and we can easily reference it in all the pages within the
same application.

e.g. # Put the message related resources in a "Messages.r esx" file in the
App_GlobalResou rces folder

<asp:Label ID="Label2" runat="server" Text="<%$ Resources:Messa ges,
Message1 %>"></asp:Label>

or

=============== =====
protected void Page_Load(objec t sender, EventArgs e)
{
string msg1 = this.GetGlobalR esourceObject(" Messages",
"Message1").ToS tring();

Label2.Text = msg1;
}
=============== =====
3. We can use the orginal means to load resource stream and get resource
item from it as we do in ASP.NET 1.0, however, we're recommended to use
the #1 and #2 in ASP.NET 2.0. Because ASP.NET 2.0 Web application project
use dynamic compilation which is not quite easy to use embeded resources.

Therefore, for your scenario, you can consider either store the Message
key/values in a page's localResource file or in a global resource file,
this depend on whether that message values is only used by a specific page
or is reused in the whole web application.

Here are some other MSDN reference articles discussing on how to perform
localization tasks in ASP.NET 2.0 Page. You can also have a look to get
some further ideas:

#ASP.NET Web Page Resources Overview
http://msdn2.microsoft.com/en-us/library/ms227427.aspx

#How to: Retrieve Resource Values Programmaticall y
http://msdn2.microsoft.com/en-us/library/ms227982.aspx

#Resources and Localization in ASP.NET 2.0
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

If you have anything unclear or any further questions, please feel free to
let me know.

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.

Jul 31 '06 #2
Many thanks.
--
bruno
"Steven Cheng[MSFT]" wrote:
Hello Bruno,

Since you mentioned that you've created local page resources through the
"Tools" --"generate local resources" menu, I think you're developing
ASP.NET 2.0 application in VS 2005. As for ASP.NET 2.0 web application, it
has provided much enhanced localization features that facilitate your work
for page localization. You have the following options to perform page
localization in ASP.NET 2.0:
1. Use local resource( in the App_LocalResour ces subdir), declaratively or
programmaticall y. And the resource items for a certain page
must be put in that page's local resource file ----- PageName.aspx.r esx

e.g. "Button1.Te xt" is a resource item's key in the page's local resource
file(in App_LocalResour ces sub folder)

<asp:Button ID="Button1" runat="server"
Text="<%$ Resources:Butto n1.Text %>" />

or
==============
protected void Page_Load(objec t sender, EventArgs e)
{
Button1.Text =
this.GetLocalRe sourceObject("B utton1.Text").T oString();
}
==============
2. Use global resource (in the App_GlobalResou rces global folder).
"App_GlobalReso urces" folder is one of the special application level
folders in ASP.NET 2.0 application which is used to store some application
scope resources and we can easily reference it in all the pages within the
same application.

e.g. # Put the message related resources in a "Messages.r esx" file in the
App_GlobalResou rces folder

<asp:Label ID="Label2" runat="server" Text="<%$ Resources:Messa ges,
Message1 %>"></asp:Label>

or

=============== =====
protected void Page_Load(objec t sender, EventArgs e)
{
string msg1 = this.GetGlobalR esourceObject(" Messages",
"Message1").ToS tring();

Label2.Text = msg1;
}
=============== =====
3. We can use the orginal means to load resource stream and get resource
item from it as we do in ASP.NET 1.0, however, we're recommended to use
the #1 and #2 in ASP.NET 2.0. Because ASP.NET 2.0 Web application project
use dynamic compilation which is not quite easy to use embeded resources.

Therefore, for your scenario, you can consider either store the Message
key/values in a page's localResource file or in a global resource file,
this depend on whether that message values is only used by a specific page
or is reused in the whole web application.

Here are some other MSDN reference articles discussing on how to perform
localization tasks in ASP.NET 2.0 Page. You can also have a look to get
some further ideas:

#ASP.NET Web Page Resources Overview
http://msdn2.microsoft.com/en-us/library/ms227427.aspx

#How to: Retrieve Resource Values Programmaticall y
http://msdn2.microsoft.com/en-us/library/ms227982.aspx

#Resources and Localization in ASP.NET 2.0
http://msdn.microsoft.com/msdnmag/is...s/default.aspx

If you have anything unclear or any further questions, please feel free to
let me know.

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.

Jul 31 '06 #3

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

Similar topics

0
533
by: Amin Schoeib | last post by:
Hi, I am a Postgres newbie who worked until now with Oracle. Now I want to know if it is possible (when yes the how?) in Postgresql To set dynamically the Localization? For example in Oracle you can set the Localization for dates like this Alter session set NLS_DATE_LANGUAGE=American NLS_TERRITORY=America This example would set the...
0
1223
by: Amin Schoeib | last post by:
Hi, I am a Postgres newbie who worked until now with Oracle. Now I want to know if it is possible (when yes the how?) in Postgresql To set dynamically the Localization? For example in Oracle you can set the Localization for dates like this Alter session set NLS_DATE_LANGUAGE=American NLS_TERRITORY=America This example would set the...
6
1975
by: Rental | last post by:
I'm having the sam problem as described below with the Localization toolkit. Does anyone know if there is a solution to this problem. --->When attempting to generate resource dlls with --->LocalizationManagement.exe, I get an exception: --->Unable to generate loose file resources
2
1545
by: Julia | last post by:
Hi, We want to migrate out asp application to asp.net and take advantage on localization. I want to ask how it is advice to structure the site directory I am going to use resource only assemblies The site is an intranet site so I don't see problems to cache some resource
8
2533
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...
5
2642
by: CMM | last post by:
I don't seem to "get" ASP.NET 2.0's Localization features. I've read up on everything... and of course, everything is explained in cursory softball terms- not any "real-world" usage way. I hope someone can give me a clue... Questions: 1) Do my eyes deceive me or is it true that localization is still totally utterly disengaged from the...
0
1636
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
3
2226
by: Corey B | last post by:
I have an ASP.NET application that was built in ASP.NET v1.1. It has a SQL Server back end database. I have been asked to provide an estimate for the level of effort required to produce a Chinese version of the application. I have read a bit about localization in .NET. However I have no experience with actually implementing localization....
3
6465
by: Computer Guru | last post by:
I have a VB.NET 2005 application with several forms and a couple hundred "strings." I've been looking into all the localization improvements in VB.NET, and I can't seem to find anything that does what I'm looking for. My application has all the strings hard-coded, I wasn't planning on localizing it when I first built it. But that's OK, I...
0
7583
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...
0
7888
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7642
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
tracyyun
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...
1
5484
isladogs
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...
0
5213
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...
1
2082
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
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
924
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...

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.