Satellite Resource Assemblies
- 3 minutes to read
Satellite resource assemblies are the standard localization mechanism provided by the .NET Framework to build multi-language applications. Refer to the following topic in the Visual Studio documentation to learn more about localization: Develop globalized and localized apps.
Obtain Satellite Assemblies
DevExpress Component Installer allows you to install satellite resource assemblies for the following cultures: German (de), Spanish (es), and Japanese (ja). Select the Community-Sourced Localization (for de, es, ja) checkbox to place the assemblies in the following folders:
- C:\Program Files\DevExpress 24.1\Components\Bin\Framework\
- C:\Program Files\DevExpress 24.1\Components\Bin\NetCore\
To obtain satellite assemblies for other cultures, use the DevExpress Localization Service that allows you to modify existing translations, compile, and download satellite assemblies.
Add Assemblies to Your Application
In the bin directory of your application, create a subfolder for every added culture. The subfolder’s name is the language code (for example, “de“). Copy satellite assemblies to the corresponding subfolder.
The following diagram illustrates where satellite assemblies should be placed within your application’s directory.
Important
You must deploy the satellite resource assemblies to the production server.
Set an Application Culture
An application culture is defined by the Culture and UICulture properties. You can specify them in the following ways.
Localize an Application for a Specific Culture (regardless of operating system settings)
Set the Culture and UICulture properties to a certain culture ID. You can specify the properties at design time or runtime.
Design Time
Add the globalization element to the Web.config file. Set the Culture and uiCulture attributes.
<system.web>
<globalization uiCulture="es" culture="es" />
...
</system.web>
Runtime
To switch a culture at runtime, specify the CurrentUICulture and CurrentCulture properties. One of the ways to adjust these properties across the entire application is handling the HttpApplication.AcquireRequestState event in the Global.asax file.
protected void Application_AcquireRequestState(object sender, EventArgs e) {
CultureInfo ci = new CultureInfo("de-DE");
Thread.CurrentThread.CurrentUICulture = ci;
Thread.CurrentThread.CurrentCulture = ci;
}
See also: How to change the current culture at runtime
Create Culture-Independent Settings in an Application
You can specify culture-independent settings in your application. For instance, always show currency in euros. To change settings without changing the current culture, follow the steps below:
- Clone current
CultureInfo
. - Change settings of the new
CultureInfo
object. Note that it is possible to copy settings from another culture instead of setting them manually. - Assign the new
CultureInfo
object toCurrentCulture
andCurrentUICulture
properties.
System.Globalization.CultureInfo newCulture = (System.Globalization.CultureInfo)System.Globalization.CultureInfo.CurrentCulture.Clone();
// Use the dot symbol as a thousand separator
newCulture.NumberFormat.NumberGroupSeparator = ".";
// Use the comma symbol as a decimal separator
newCulture.NumberFormat.NumberDecimalSeparator = ",";
// Show currency in euros
newCulture.NumberFormat.CurrencySymbol = "€";
// Copy date-time format from the en-us culture
newCulture.DateTimeFormat = new CultureInfo("En-US").DateTimeFormat;
System.Threading.Thread.CurrentThread.CurrentCulture = newCulture;
System.Threading.Thread.CurrentThread.CurrentUICulture = newCulture;