473,795 Members | 2,980 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with Multi-language site

I am developing a web site at work that needs to be both in French and
English. I have been reading up on using resource files (.resx files) in
combination with setting the CultureInfo to either "en-CA" (Canadian
English) or "fr" (French), then retrieving the appropriate variables from
the resx file with a ResourceManager depending on the current Culture. That
seems straightforwrad enough. Whenever I want a label or any other control
that displays text to display text, I just assign its text value the value
in the resx file. What I would like to do is encapsulate that whole process
so all I need to do is call a sub, for example "setPageTex t", in an object,
for example "Language", that would do all the labelling of the controls for
me. I thought that maybe I could just have the sub take as a parameter the
entire page. It could then loop through all the controls and set the text
property of each to the right value that is pulled from the resx file. So
the way I see it, all I would have to do in the Page_Load is include this
code:

Dim myLanguage as new Language("myRes ourceFileName")
myLanguage.setP ageText(me)

The code below seems to do the trick for looping through the controls of the
page (it actually seems to loop more times that I would have expected
showing "literal controls" -- does it consider straight html as a literal
control?). However, how can I set the text value of each of the controls if
I don't know what kind of control it is? Basically, any control that has a
text value (label, checkbox, radio button, etc) I would like to set its
value using the resx file. I am moreorless new to ASP.Net and VB.Net, so
perhaps this is an easy question. I guess once I find out what kind of
control it is, I would then cast it to this conrol and then set its text
value? Or is no casting necessary?

Is there some soundness in the general idea of what I am trying to
accomplish, or is there another way that I should be considering? In a
nutshell, I don't want to have to call the ResourceManger' s getString()
function everytime I have text that could be in either English or French.

Thanks for any suggestions,
Marcus Bell
*************** *************** ***********
Public Class Language
Protected myRM As ResourceManager

Sub New(ByVal myResource As String)
myRM = New ResourceManager (myResource, GetType(junk3). Assembly)
End Sub

Sub setPageText(ByV al myControl As Control)
Dim myType As String
Dim name As String
Dim c As Control
If myControl.HasCo ntrols Then
For Each c In myControl.Contr ols
setPageText(c)
Next
Else
myType = myControl.GetTy pe.ToString
name = myControl.ID
If name <> "" Then
'****** put code here that determines the type of control
that is currently in scope and get the text from the resrouce file
'****** using the ResourceManger class
End If
End If
End Sub
End Class
*************** *************** ***********
Nov 19 '05 #1
0 1275

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

Similar topics

1
1973
by: Silver | last post by:
Hi everyone, my program compiles and executes, but I get an error during run-time. I guess it has something to do with memory allocation (which I don't seem to fully control yet).. Here's the code: #include <iostream> #include <malloc.h> #include <iomanip> using namespace std;
7
1901
by: Shane | last post by:
Hi, Thanks in advance for the help. I have been to many websites and tried several solutions to my problem, but have fixed part of it. It's time to come humbly to the newsgroups for help :-) By the way, please don't reply just to tell me that my code isn't optimized and that I should use a delimited database rather than a line by line record. If I had my way, I'd do it differently too.
9
1717
by: cheryl | last post by:
I am relatively new to programming in Access for a multi user environment, and am having trouble figuring out if there is a way to accomplish one of our user requests. I am working on a multi user Access 2002 application. BE db resides on a LAN, FE on each client. The app imports large .csv files containing billing info by date and allows users to run various reports. At a given time, one user may be importing a file into the main...
1
2728
by: Joe | last post by:
I have the following 3 tables: Clients, which has a numeric PK field called CLIENT_ID Languages, which has a numeric PK field called LANGUAGE_ID Client_Languages, which has a unique PK and foreign key fields CLIENT_ID and LANGUAGE_ID Clients and Languages each have a one-to-many relationship with
4
17880
by: mimmo | last post by:
Hi! I should convert the accented letters of a string in the correspondent letters not accented. But when I compile with -Wall it give me: warning: multi-character character constant Do the problem is the charset? How I can avoid this warning? But the worst thing isn't the warning, but that the program doesn't work! The program execute all other operations well, but it don't print the converted letters: for example, in the string...
22
4073
by: Jeff Louie | last post by:
Well I wonder if my old brain can handle threading. Dose this code look reasonable. Regards, Jeff using System; using System.Diagnostics; using System.IO; using System.Threading;
15
2584
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to determine who needs to receive the text message then send the message to the address. Only problem is, the employee may receive up to 4 of the same messages because each thread gets the recors then sends the message. I need somehow to prevent...
2
1916
by: deezle | last post by:
Hello, I am trying to get my calculator GUI to +,-,* and /. I have got all of them to work except my division. I was wondering if someone could helpme figure out the problem. Any input would help and I'll leave my code in here ========================================================= package chapfour; /** * * @author Deezle */ import java.awt.*;
0
1535
by: Kevin McKinley | last post by:
Below i've put the code for a program that i wrote. I need help on lines 384-403. If you run this program you will notice on the first tab when have it produce an answer the $ is surrounded with {$}. How can i get rid of that? from Tkinter import * class MyApp: def __init__(self, parent): self.myparent = parent
0
1514
by: Guilherme Polo | last post by:
On Wed, Sep 3, 2008 at 8:57 PM, Kevin McKinley <kem1723@yahoo.comwrote: Come on.. "help on lines 384-403", that is not a good way to look for help. You are supposed to post some minimal code that demonstrates the problem. Anyway, this demonstrates what you are getting (independent of python version): import Tkinter
0
9673
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
9522
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
10448
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10217
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 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...
1
10167
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10003
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9046
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
5440
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...
1
4114
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 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.