Localization

Localization is the key feature to provide software solutions targeted at global users. The SfPivotChart allows users to localize the control to a specific locale and supports “resx” based localization.

You should perform the following steps to localize the control:

  • Translation.
  • Resource file and file name conventions.
  • Culture specification.

Translation

The first step in localization is translating the strings that can be localized to the destination locale.

NOTE

Localization key field should be same for all locales. Do not translate the key fields.

Resource file and file name conventions

After translating the strings, perform the following steps in the application:

  1. Right-click the project file to create a new folder in the project by selecting Add > New Folder and rename the folder as “Resources”.

  2. Then, right-click the Resources folder to create a new resource file by selecting Add > New Item.

NOTE

The resource file name should be in the format “<Culture Code>.resx”.

  1. Copy and paste the translated locale to the resource file which is created in the previous step.

Culture specification

You should specify the CurrentUICulture in Application_Startup method of the App.xaml.cs file or constructor of the MainPage.xaml.cs file.

NOTE

If you are specifying the current culture in the constructor of MainPage, then ensure that the culture is specified before calling the InitializeComponent() method.

public sealed partial class MainPage : Page
{
    public MainPage()
    {
        ApplicationLanguages.PrimaryLanguageOverride = "ar-AE";
        this.InitializeComponent();
    }
}
Public NotInheritable Partial Class MainPage
	Inherits Page
	Public Sub New()
		ApplicationLanguages.PrimaryLanguageOverride = "ar-AE"
		Me.InitializeComponent()
	End Sub
End Class

RTL

The SfPivotChart provides RTL support to display the content from right to left direction by setting the FlowDirection property to RightToLeft.

<syncfusion:SfPivotChart x:Name="PivotChart1" FlowDirection="RightToLeft"
                         ItemSource="{Binding ProductSalesData}" PivotAxis="{Binding PivotAxis}"
                         PivotLegend="{Binding PivotLegend}" PivotCalculations="{Binding PivotCalculations}"/>
PivotChart1.FlowDirection = FlowDirection.RightToLeft;
PivotChart1.FlowDirection = FlowDirection.RightToLeft

A demo sample is available in the following location.

{system drive}:\Users\<User Name>\AppData\Local\Syncfusion\EssentialStudio\<Version Number>\Samples\UWP\SampleBrowser\PivotChart\PivotChart\View\Localization.xaml