For some systems developed, it is often required to support multiple languages (such as Japanese and English). In the past, most of the practices were to create a resource file,
Set each label, button, and other title text in various languages in advance,
Display the corresponding text in the program based on the selected language.
The disadvantage of doing so is that every time you modify or add a control, the program developers need to deliberately do multiple language mappings,
If you want to change the description of certain titles, you also need to change the resource file and replace it with the program release directory.
After investigation and experiment, I finally figured out a way to better address this problem:
On each web page, set a button (for example, "set") that can only be viewed with the highest level of management permissions "),
To set the fixed titles on the screen. Click this button to display all
Controls (such as Label, button, gridview, linkbutton, etc.) are displayed on a small page in various languages for users to set,
Save it to DB. When you open the page next time, follow the title of the page control in the initial stage of the content set by DB.
End users are free to set and do not need to be constantly modified by developers.
The screen effect is as follows:
Click "set"
The following is an example of code that indicates that controls (TextBox, DropDownList, and so on) on the page are not available:
Copy codeThe Code is as follows:
Public Shared Sub LoopingControlsDisabled (ByVal oControl As Control)
Dim frmCtrl As Control
Dim btn As Button
For Each frmCtrl In oControl. Controls
If TypeOf frmCtrl Is TextBox Then
DirectCast (frmCtrl, TextBox). Enabled = False
End If
If TypeOf frmCtrl Is DropDownList Then
DirectCast (frmCtrl, DropDownList). Enabled = False
End If
If TypeOf frmCtrl Is CheckBox Then
DirectCast (frmCtrl, CheckBox). Enabled = False
End If
If TypeOf frmCtrl Is RadioButton Then
DirectCast (frmCtrl, RadioButton). Enabled = False
End If
If TypeOf frmCtrl Is FileUpload Then
DirectCast (frmCtrl, FileUpload). Enabled = False
End If
If TypeOf frmCtrl Is Button Then
Btn = DirectCast (frmCtrl, Button)
'If btn. Text. Equals ("close") OrElse btn. ID. Equals ("btnClose") Then
If btn. ID. Equals ("btnClose") Then
'Only the close button is available
Btn. Enabled = True
Else
Btn. Enabled = False
End If
End If
If frmCtrl. HasControls Then
LoopingControlsDisabled (frmCtrl)
End If
Next
End Sub