Wisej.NET
Ask or search…
K

Localization

Wisej is fully localizable using .NET and Visual Studio standard localization features.
wisej.localization.zip
307KB
Binary
Download Wisej.Localization.zip

Localizing the UI

All the top level controls in Wisej support UI localization.
To enable the localization features for a Form, Page, UserControl, or Desktop component, when in design mode set the Localizable property to true. After the localization feature is enabled, you can switch the language in the designer.
To switch the language, use the Language drop down property to select the language to localize
UI localization lets you change a large number of properties in relation to a language switch. The most common are the Size, Location, Text, Colors, and Images.

Localizing the System

Wisej also supports the full localization of system resources, such as the buttons in the MessageBox and the labels (month and day names) in the calendar controls, as well as all the standard numeric, percentage and currency formatting and parsing.
  • Numeric, Percentage, Date, and Currency Formats
    You don't have to do anything, it's all handled automatically for just about any language in the world.
  • Date Labels: Months and Day Names
    Also in this case you don't have to do anything, it's all handled automatically for just about any language in the world.
  • System Resources
    At the time, all Wisej system resources are localized in English, German, French, Italian, Turkish, Spanish and Portuguese. You have to provide the localization in any other language. All you need to do is to create a Resources-[LANG].resx file either in the root folder of the project or in the /Resources folder and add the labels to localize. See How to: Create a Localized Version of a Resource File.
    Label
    Description
    Default Value
    $Ok
    OK Button in the MessageBox or other system dialogs.
    OK
    $Cancel
    Cancel Button in the MessageBox or other system dialogs.
    Cancel
    $Yes
    Yes Button in the MessageBox or other system dialogs.
    Yes
    $No
    No Button in the MessageBox or other system dialogs.
    No
    $Retry
    Retry Button in the MessageBox or other system dialogs.
    Retry
    $Ignore
    Ignore Button in the MessageBox or other system dialogs.
    Ignore
    $Abort
    Abort Button in the MessageBox or other system dialogs.
    Abort
    $Next year
    Tooltip for the next-year navigation button in the MonthCalendar and DateTimePicker Date Selector.
    Next Year
    $Next month
    Tooltip for the next-month navigation button in the MonthCalendar and DateTimePicker Date Selector.
    Next Month
    $Last year
    Tooltip for the last-year navigation button in the MonthCalendar and DateTimePicker Date Selector.
    Last Year
    $Last month
    Tooltip for the last-month navigation button in the MonthCalendar and DateTimePicker Date Selector.
    Last Month
    $Offline
    Text shown in the offline toast when the system detects a loss of connectivity.
    Offline

Localizing Resources

In addition to formatting, parsing, system labels and controls, you will most likely need to localize other resources (strings, images, ...) used in the code of your application.
You may create as many resource files (.resx) as you like and localize them using the same approach explained above and here: How to: Create a Localized Version of a Resource File.
In your code you can simply create an instance of the ResourceManager Class and use it to retrieve the localized values. Wisej takes care of switching the culture of the thread that is managing the client request.
C#
VB.NET
var RS = new ResourceManager("Localization.Resources", this.GetType().Assembly);
var title = RS.GetString("Title");
Dim RS as ResourceManager = new ResourceManager("Localization.Resources", Me.GetType().Assembly)
Dim title as String = RS.GetString("Title")

Detecting/Switching the Browser Language

Wisej automatically recognizes the browser's language and switches all the application and system resources to use the browser's language.
You may force the application (user session) to run using a specific language setting the culture property in Default.json. The default value is "auto". See Configuration for more information about setting the application's culture.
You may also always force the user session to use a specific language in two alternative ways:
  • Set the culture by assigning Application.CurrentCulture property.
  • Add the lang argument to the URL. For example, to switch to German: http://localhost/myapp?lang=de.
When the current culture changes from the original culture loaded when the session was started, Wisej fires the Application.CultureChanged event.
Controls that have been localized using the designer are updated only when they are created. There is no built-in mechanism to change controls that have already been created. If you want to be able to alter controls that have been created with a different culture you have to either re-create the container and invoke InitializeControl again; or write custom code that applies the resource again.