473,406 Members | 2,707 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,406 software developers and data experts.

Trying localization with Sams Tips&Tricks

Hi,

I have a very good book on asp.net Sams ASP.NET Tips, Tutorials and Code
ISBN 0-672-32143-2 and is trying to teach myself from examples from this book
Chapter 16.

Anyway I come quite close when trying to run one example but then I get this
message I don't understand:

"This .resources file shouldn't be used with this reader. Your resource
reader type: System.Resources.ResourceReader, mscorlib, Version=1.0.2411.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"

What does it mean?

Seems my english isn't good enough.

TIA

Kenneth P
Nov 18 '05 #1
3 2070
Hi,

can you post us the code ?

regards
Joyjit

"Kenneth P" <Ke******@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
Hi,

I have a very good book on asp.net Sams ASP.NET Tips, Tutorials and Code
ISBN 0-672-32143-2 and is trying to teach myself from examples from this book Chapter 16.

Anyway I come quite close when trying to run one example but then I get this message I don't understand:

"This .resources file shouldn't be used with this reader. Your resource
reader type: System.Resources.ResourceReader, mscorlib, Version=1.0.2411.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"

What does it mean?

Seems my english isn't good enough.

TIA

Kenneth P

Nov 18 '05 #2
Hmmm...

Where should I post it, because it contains five very small (1kb) compiled
resource files as well as the code?

Kenneth P
"Joyjit Mukherjee" wrote:
Hi,

can you post us the code ?

regards
Joyjit

"Kenneth P" <Ke******@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
Hi,

I have a very good book on asp.net Sams ASP.NET Tips, Tutorials and Code
ISBN 0-672-32143-2 and is trying to teach myself from examples from this

book
Chapter 16.

Anyway I come quite close when trying to run one example but then I get

this
message I don't understand:

"This .resources file shouldn't be used with this reader. Your resource
reader type: System.Resources.ResourceReader, mscorlib,

Version=1.0.2411.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"

What does it mean?

Seems my english isn't good enough.

TIA

Kenneth P


Nov 18 '05 #3
Sure, why not,

Here's the code for the .aspx, named 16.3.2.aspx

<%@ Page Inherits="myCodeBehind_1633" Src="16.3.3.vb"
ResponseEncoding="utf-8" %>
<html>
<head>
<title>Using Resource Files in ASP.NET</title>
</head>
<body style="FONT: x-small Verdana, Arial, sans-serif">
<form method="post" runat="server">
<b>The Current Culture is:</b>
<asp:Label id="CultureType" runat="server"></asp:Label>
<hr />
<p>
<b>
<asp:Label id="Welcome" runat="server"></asp:Label>
</b>
</p>
<p>
<b>
<asp:Label id="Choose" runat="server"></asp:Label>
</b>
<asp:DropDownList id="EncodType" runat="server"
AutoPostBack="True">
<asp:ListItem Value="en-US" Text="English" />
<asp:ListItem Value="en-NZ" Text="English (New Zealand)" />
<asp:ListItem Value="fr-FR" Text="French" />
<asp:ListItem Value="de-DE" Text="German" />
<asp:ListItem Value="he-IL" Text="Hebrew" />
<asp:ListItem Value="ja-JP" Text="Japanese" />
<asp:ListItem Value="es-MX" Text="Spanish (Mexican)" />
<asp:ListItem Value="uk-UA" Text="Ukrainian (Ukraine)" />
</asp:DropDownList>
</p>
<asp:DataGrid id="myDataGrid" runat="server"
AutoGenerateColumns="False" HeaderStyle-ForeColor="White"
HeaderStyle-BackColor="Black" Font-Size="8pt" Font-Name="Verdana"
ShowFooter="false" BorderColor="black" Width="740">
<Columns>
<asp:BoundColumn DataField="FirstName" />
<asp:BoundColumn DataField="LastName" />
<asp:BoundColumn DataField="BirthDate"
DataFormatString="{0:D}" />
<asp:BoundColumn DataField="HireDate"
DataFormatString="{0:D}" />
</Columns>
</asp:DataGrid>
</form>
</body>
</html>

and here's the code behind file 16.3.3.vb

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Globalization
Imports System.Threading
Imports System.Resources
Imports System.IO

Public Class myCodeBehind_1633 : Inherits Page

Public myDataGrid As DataGrid
Public EncodType As DropDownList
Public CultureType As Label
Public Choose As Label
Public Welcome As Label
Public rm As ResourceManager =
ResourceManager.CreateFileBasedResourceManager("my ResourceFile",
Server.MapPath("/resources") & Path.DirectorySeparatorChar, Nothing)

Public Sub Page_Load(Sender As Object, E As EventArgs)
Dim culture As CultureInfo
Dim myDataAdapter As SqlDataAdapter
Dim myDataSet As New DataSet

If Not Page.IsPostBack Then
culture = CultureInfo.CurrentCulture
Else
culture = New CultureInfo(EncodType.SelectedItem.Value)
Thread.CurrentThread.CurrentCulture = culture
End If

CultureType.Text = culture.EnglishName
Welcome.Text = rm.GetString("Greeting", culture)
Choose.Text = rm.GetString("EncMessage", culture)

myDataGrid.Columns(0).HeaderText = rm.GetString("FirstName", culture)
myDataGrid.Columns(1).HeaderText = rm.GetString("LastName", culture)
myDataGrid.Columns(2).HeaderText = rm.GetString("BirthDate", culture)
myDataGrid.Columns(3).HeaderText = rm.GetString("HireDate", culture)

myDataAdapter = New SqlDataAdapter("Select LastName, FirstName,
BirthDate, HireDate From Employees", _
"server=localhost;database=Northwind;uid=sa;pwd=oh lywohly;")
myDataAdapter.Fill(myDataSet, "Employees")

myDataGrid.DataSource = myDataSet.Tables("Employees").DefaultView
myDataGrid.DataBind()
End Sub

End Class

and here's the code for the five resources files. you have to compile them
first before using them using

resgen
C:\Inetpub\wwwroot\Sams\TipsTricks\C16\resources\m yResourceFile.de-DE.txt
C:\Inetpub\wwwroot\Sams\TipsTricks\C16\resources\m yResourceFile.de-DE.resources

resgen
C:\Inetpub\wwwroot\Sams\TipsTricks\C16\resources\m yResourceFile.fr-FR.txt
C:\Inetpub\wwwroot\Sams\TipsTricks\C16\resources\m yResourceFile.fr-FR.resources

resgen
C:\Inetpub\wwwroot\Sams\TipsTricks\C16\resources\m yResourceFile.en-NZ.txt
C:\Inetpub\wwwroot\Sams\TipsTricks\C16\resources\m yResourceFile.en-NZ.resources

resgen
C:\Inetpub\wwwroot\Sams\TipsTricks\C16\resources\m yResourceFile.es-MX.txt
C:\Inetpub\wwwroot\Sams\TipsTricks\C16\resources\m yResourceFile.es-MX.resources

resgen C:\Inetpub\wwwroot\Sams\TipsTricks\C16\resources\m yResourceFile.txt
C:\Inetpub\wwwroot\Sams\TipsTricks\C16\resources\m yResourceFile.resources

first 'myResourceFile.de-DE.txt'

[strings]
Greeting = Willkommen!
FirstName = Vorname
LastName = Familienname
BirthDate = Geburtsdatum
HireDate = Miete-Datum
EncMessage = Wählen Sie Ihre Verschlüsselung:

and then no two with the name 'myResourceFile.en-NZ.txt'

[strings]
Greeting = Good Day!

and number three 'myResourceFile.es-MX.txt'

[strings]
Greeting = Bienvenido!
FirstName = Nombre de pila
LastName = Apellido
BirthDate = Fecha de Nacimiento
HireDate = Fecha de Alquiler
EncMessage = Escoja su codificación:

number four: 'myResourceFile.fr-FR.txt'

[strings]
Greeting = Accueil!
FirstName = Prénom
LastName = Nom de famille
BirthDate = Date de Naissance
HireDate = Date de Location
EncMessage = Choisissez votre codage:

and at last number 5: 'myResourceFile.txt'

[strings]
;
; lines beginning with semi-colons are treated as comments
;
; Specify a locale-specific welcome message
Greeting = Welcome!
;
; Create locale-specific header text for our DataGrid
FirstName = First Name
LastName = Last Name
BirthDate = Birth Date
HireDate = Hire Date
;
; Create locale-specific text for our Label
EncMessage = Choose your encoding:

The .resources files should be saved to a /resources directory below the
root directory.

Kenneth P.

"Joyjit Mukherjee" wrote:
Hi,

can you post us the code ?

regards
Joyjit

"Kenneth P" <Ke******@discussions.microsoft.com> wrote in message
news:62**********************************@microsof t.com...
Hi,

I have a very good book on asp.net Sams ASP.NET Tips, Tutorials and Code
ISBN 0-672-32143-2 and is trying to teach myself from examples from this

book
Chapter 16.

Anyway I come quite close when trying to run one example but then I get

this
message I don't understand:

"This .resources file shouldn't be used with this reader. Your resource
reader type: System.Resources.ResourceReader, mscorlib,

Version=1.0.2411.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"

What does it mean?

Seems my english isn't good enough.

TIA

Kenneth P


Nov 18 '05 #4

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

Similar topics

8
by: Corrupted Mind | last post by:
I have just finished the K&R's book. And, I would like to know what to forget and add to the teaching of K&R? I ask this because I know that no book is perfect, nor complete. ( even if they are the...
1
by: code | last post by:
Hi Grp http://www.books-download.com/?Book=1493-PHP+Hacks+%3a+Tips+%26+Tools+For+Creating+Dynamic+Websites+(Hacks) Description Programmers love its flexibility and speed; designers love its...
1
bartonc
by: bartonc | last post by:
Go to http://www.thescripts.com/forum/forum152.html to start discussions on: > how much python dictionaries are like SQL tables > how to use MySQLdb extention, including ODBC
17
sashi
by: sashi | last post by:
Hi everyone, Here are some VB related tips & tricks, hope it helps. Good luck & Take care. Important This thread is closed for general posting. Please start a new thread if you have a...
0
by: travolta006 | last post by:
Learn how to optimize and tune up your system, get rid of boring errors and uninstall unnecessary thing with very useful tips and tricks http://windowsxpsp2pro.blogspot.com
6
by: travolta009 | last post by:
Learn how to optimize and tune up your system, get rid of boring errors and uninstall unnecessary thing with very useful tips and tricks http://windowsxpsp2pro.blogspot.com
0
by: kamalpp | last post by:
hi check http://aspnet-tips-tricks.blogspot.com/ for tips and tricks Thanks
0
by: css | last post by:
http://php.apachai.com a lot of php tips & tricks
0
by: Dhanabal | last post by:
FREE Tutorials on HTML XHTML CSS JavaScript XML XSL ASP SQL ADO VBScript, SAP - ABAP visit ebooks.univdatabase.com
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
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...
0
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...
0
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,...
0
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...

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.