We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to localize inline strings in schedule month view without changing locale in device ?

Platform: Xamarin.Forms |
Control: SfSchedule |
Published Date: September 28, 2018 |
Last Revised Date: September 28, 2018

You can localize the custom strings (All Day, No Events) used in the schedule control month inline view from PCL without changing locale in device. It can be achieved by providing the custom strings to the specific language resx file and handling the required culture with the locale using DependencyService instead of device language. In the below code, we have set French as Schedule locale as well as custom strings.

 

Step 1: Sample changes, setting locale

 

 

Step 2:  Adding resx file in pcl

 

You need to add the required resx files under the Resources folder in the PCL project and the filename should be Syncfusion.SfSchedule.Forms.LanguageCode.resx.

Example: For French, Syncfusion.SfSchedule.Forms.fr.resx

Now, set the Build Action as EmbeddedResource for Syncfusion.SfSchedule.Forms.fr.resx file and Build Action as Compile for Syncfusion.SfSchedule.Forms.fr.Designer.cs file.

 

 

Step 3:  Adding ILocalize interface in PCL

 

You need to add the ILocalize interface to convert the platform-specific locales to a value supported in .NET cultures in the PCL project.

 

 

Step 4: Adding Localize class in Android and iOS project inheriting from ILocalize

 

You need to add the Localize class in Android and iOS project by inheriting from ILocalize. You can get the CultureInfo and set the same to Schedule Locale by using GetCurrentCultureInfo and SetLocale.

 

Localize class for Android project,

 

[c#]

 

Localize class for iOS project,

 

 

You can download the entire source code of this demo for Xamarin.Forms from
here LocaleFromPCL_Sample.

 

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile