Localization in UWP Pivot Gauge (SfPivotGauge)
10 May 20212 minutes to read
Localization is a key feature to provide software solutions targeted at global users. The SfPivotGauge 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
The localization key field should be the same for all locales. Do not translate it.
Resource file and file name conventions
After translating the strings that can be localized:
-
Right-click the project file to create a new folder in the project. Select Add > New Folder and rename the folder “Resources”.
-
Right-click the Resources folder to create a new resource file. Go to Add > New Item.
NOTE
The resource file name should be in the format “<Culture Code>.resx”.
- Copy and paste the translated locale to the resource file created in the previous step.
Culture specification
You should specify the CurrentUICulture in the Application_Startup method of App.xaml.cs file or the constructor of the MainPage.xaml.cs file.
NOTE
If you are specifying the current culture in the constructor of main page, 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 SfPivotGauge provides RTL support to display the content from right to left by setting the FlowDirection
property to RightToLeft.
<syncfusion:SfPivotGauge x:Name="PivotGauge1" FlowDirection="RightToLeft"
ItemSource="{Binding ProductSalesData}" PivotRows="{Binding PivotRows}"
PivotColumns="{Binding PivotColumns}" PivotCalculations="{Binding PivotCalculations}">
</syncfusion:SfPivotGauge>
PivotGauge1.FlowDirection = FlowDirection.RightToLeft;
PivotGauge1.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\PivotGauge\PivotGauge\View\Localization.xaml