|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionThe .NET Framework has great support for multi-language applications. You can put all your translated form text in resource files. What happens when you bind a UsageFirst, read my previous article on Inherited DataSets. The version of the DataSet Generator with this article is basically a further developed version. The magic is done with this piece of generated code: Public Overridable Property Localizable() As Boolean
Get
Return Me._Localizable
End Get
Set(ByVal Value As Boolean)
_Localizable = value
If value Then
Dim resourceManager As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(TestDataSet1))
Dim tableIndex As Integer
Dim columnIndex As Integer
Dim caption As String
tableIndex = 0
Do While (tableIndex < Me.Tables.Count)
columnIndex = 0
Do While (columnIndex < Me.Tables(tableIndex).Columns.Count)
Try
caption = resourceManager.GetString( _
String.Join(".", New String()_
{Me.Tables(tableIndex).TableName, _
Me.Tables(tableIndex).Columns(columnIndex).ColumnName, "Caption"}))
Catch ex As System.Exception
End Try
If (Not (caption) Is Nothing) Then
Me.Tables(tableIndex).Columns(columnIndex).Caption = caption
End If
columnIndex = (columnIndex + 1)
Loop
tableIndex = (tableIndex + 1)
Loop
End If
End Set
End Property
All you have to do to make the The choice is yours!Of course, you don't want to translate all captions all the time. Accessing resource files may create unnecessary overhead. First, if you leave out Caption translations from the resource files, no translation work will be done. Second, as long as you don't set the Other optionsWout de Zeeuw proposed translating object properties so they would display correctly in a
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||