Re: How to build the multi-language application?
- From: " Screaming Eagles 101" <see_my_site@xxxxxxxxxxxxx>
- Date: Mon, 27 Oct 2008 14:00:31 +0100
"YXQ" <YXQ@xxxxxxxxxxxxxxxxxxxxxxxxx> schreef in bericht
news:5685F194-9D94-4668-B201-E15A4229741C@xxxxxxxxxxxxxxxx
Thank you, where can find the samples?
"Herfried K. Wagner [MVP]" wrote:
"yxq" <gayxq@xxxxxxx> schrieb:
I want to build the multi-language application with the xml file, how
to
do? could anyone tell a sample?
Why not use 'My.Resources' and custom "Resources.<culture name>.resx"
files
(which will be compiled and embedded automatically when building the
project)?
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Short description on how I do it, this could help for a start :
- I add a resource file for each language, for instance English.Resx,
Dutch.Resx, etc....
- I add all components which do have a Text property, such as labels for
instance... but you can also add standard strings to use in msgboxes...
Example : in Resource File : column Name "btnAdd" (this is the same in
all resource files),
value "Add..." of course different value in other languages.
- Some code then in a separate module to open the resource file and read it
Declaration :
'Application Language
Public rm As Resources.ResourceManager
'Function
Public Function getRMValue(ByVal strValue As String)
Dim strLanguage As String
If IsNothing(rm) Then
'Get system language
strLanguage =
System.Globalization.CultureInfo.CurrentCulture.ToString.ToUpper.Substring(0,
2)
'Set resource manager
If strLanguage = "EN" Then
rm = My.Resources.English.ResourceManager
Else
rm = My.Resources.Dutch.ResourceManager
End If
End If
getRMValue = rm.GetString(strValue)
End Function
- In the forms :
btnAdd.text = getRMValue("btnAdd")
Hope this helps a bit
Phil
.
- References:
- How to build the multi-language application?
- From: yxq
- Re: How to build the multi-language application?
- From: Herfried K. Wagner [MVP]
- Re: How to build the multi-language application?
- From: YXQ
- How to build the multi-language application?
- Prev by Date: Re: How to build the multi-language application?
- Next by Date: FileLogTraceListener properties, how to change?
- Previous by thread: Re: How to build the multi-language application?
- Next by thread: Re: How to build the multi-language application?
- Index(es):
Relevant Pages
|