Web page elements multilingual (multi-lingual) to achieve sharing _ practical skills

Source: Internet
Author: User

Developed systems that often require support for multiple languages (such as Japanese, English, etc.), and most of the previous practice was to create a resource file,

Each label, button and other title text in advance with a variety of language settings to save,

Displays the corresponding text in the program according to the selected language.

The disadvantage of this is that if you change or add one control at a time, you need the program developer to deliberately do more than the language counterpart,

If the user wants to change the description of some titles, the developer will also need to change the resource file and replace it with the program publishing directory.

After the investigation experiment, finally thought of a way to better correspond to this problem:

On each Web page, set a button (such as "set") that only has the highest administrative privileges to see.

To be responsible for the setting of the fixed headings on the screen, just click on the button to display all the desired controls on the page through the control traversal method.

Control (such as Label,button,gridview,linkbutton, etc.), display the contents of its various languages to a small page, let the user set their own,

Then save to DB. The next time you open it, the title of the page control is initialized with the content set by DB.

The end user is free to set up, without the need for developers to constantly modify.

The screen effect is as follows:

Click "Set"

For example, the loop sets the code that is not available for the control (textbox,dropdownlist, etc.) in the page:

Copy Code code 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 ("Off") OrElse Equals ("Btnclose") Then
If Equals ("Btnclose") Then
' Close button only available
Btn. Enabled = True
Btn. Enabled = False
End If
End If
If Frmctrl.hascontrols Then
Loopingcontrolsdisabled (Frmctrl)
End If
End Sub

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.