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

SfDateTimeRangeNavigator localization

Hi,

Is it possible to localize or somehow customaze labels for the control (tooltip, minor and majorscales)?

Thanks,
Dario

10 Replies

DV Divya Venkatesan Syncfusion Team April 25, 2017 04:19 PM UTC

Hi Dario,

By default, localised strings will be applied to Minor/Major scale labels and tooltip labels depends on the language chosen in the device’s settings.

In Xamarin.Forms Android alone, for Quarter and Week strings, values should be given in strings.xml in each language specific directory. The directory name should be suffixed with language code (eg. values-es for Spanish).

Example:

The Spanish directory values-es contains a file Strings.xml with following values:

values-es/Strings.xml :
  
<?xml version="1.0"encoding="utf-8" ?> 
<resources> 
  <string name="quarter">Trimestre</string> 
  <string name="q">Q</string> 
  <string name="week">Semana</string> 
  <string name="w">W</string> 
</resources> 
 
  
Please download the sample from following location.

Sample: https://www.syncfusion.com/downloads/support/forum/130097/ze/LocalizationSample-1297583118

Please let us know if your requirement is different from this.

Regards,
Divya Venkatesan 



DS Dario Senic April 27, 2017 12:01 PM UTC

That did help.

Much appreciated,
Dario


SP Saravana Pandian Murugan Syncfusion Team April 28, 2017 06:53 AM UTC

Hi Dario,

Thanks for the update. We are glad to know that the given solution worked. Please get back to us if you need further assistance.

Regards,
Saravana Pandian M. 



DP David Perera October 5, 2017 07:37 AM UTC

I want to do the same on iOS since it does not take into account my device settings (Spanish), and it says week instead of semana. Also I would want it to be configurable (e.g. the app language should be independent from the device settings language, as I have many users and depending on the user I select one or other language)



DV Divya Venkatesan Syncfusion Team October 9, 2017 12:52 PM UTC

Hi David,

Regarding "it says week instead of semana",
You can achieve this in application level by defining the respective string for Week in Spanish in application level similar to Android.

Regarding "language should be independent from the device settings language"
Currently we are trying to achieve this in application level and we are facing some issues in it.

We will update you the sample for both the requirements along with more details at the earliest.

Thanks for your patience.

Regards,
Divya Venkatesan


SP Saravana Pandian Murugan Syncfusion Team October 10, 2017 05:21 PM UTC

Hi David, 
  
Sorry for the delay. 
  
1. Regarding the query, “I want to do the same on iOS since it does not take into account my device settings (Spanish), and it says week instead of semana” 
  
  • In application level, you need to keep the folder in Xamarin.Forms iOS project under Resources -> {localizationprefix}.lproj -> Localizable.strings.
  
                            Ex: In your case, Resources -> es.lproj->Localizable.strings 
  
  • In this Localizable.strings file, you need to add string with same key given in our source Localizable.strings file. For value, you should provide the equivalent localized string for the Spanish string which we keep in source Localizable.strings. 
  
Ex: In your case, add this string (“Week=”Semana;”) in Localizable.strings file. 
  
2. Regarding the query “Also I would want it to be configurable (e.g. the app language should be independent from the device settings language, as I have many users and depending on the user I select one or other language)” 
  
In Android, we can change CultureInfo/language in application level by using the below code in Xamarin.Forms Android project under MainActivity.cs.  
 
Code Example:  
  
  Resources res = this.ApplicationContext.Resources; 
  
  // Change locale settings in the app. 
  DisplayMetrics dm = res.DisplayMetrics; 
  
  Android.Content.Res.Configuration conf = res.Configuration; 
  
  conf.SetLocale(newLocale("es")); // Your language code 
  
  res.UpdateConfiguration(conf, dm); 
  
  
For iOS, we will update you with more details at the earliest. 
 
We have attached sample for these requirements which can be downloaded from the following location. 
  
  
Please check the attached sample and let us know if you have any concerns in this. 
  
Regards, 
Saravana Pandian M 



SP Saravana Pandian Murugan Syncfusion Team October 11, 2017 02:23 PM UTC

Hi David,

Regarding the query “Also I would want it to be configurable (e.g. the app language should be independent from the device settings language, as I have many users and depending on the user I select one or other language)”

In iOS, you can change the default CultureInfo/language in application level by following the below steps.

In application level, you need to keep the folder in Xamarin.Forms iOS project under Resources -> {localizationprefix}.lproj -> Localizable.strings.

Ex: In your case, Resources -> es.lproj->Localizable.strings

In this Localizable.strings file, you need to add string with same key given in our source Localizable.strings file. For value, you should provide the equivalent localized string for the Spanish string which we keep in source Localizable.strings.

Ex: In your case, add this string (“Week=”Semana;”) in Localizable.strings file.

Then, go to the Info.plist file -> Click Source tab -> Add new property Localization native development region and provide your culture name as key.

Ex: In your case, the key should be es string.

Please refer the below link for further details.

Link: https://stackoverflow.com/questions/21460202/set-default-localization-of-ios-app

We have modified the sample as per this requirement which can be downloaded from the following location.

Sample: https://www.syncfusion.com/downloads/support/forum/130097/ze/LocalizationSample1751063095

Please check the attached sample and let us know if you need further assistance on this.

Regards,
Saravana Pandian M



DP David Perera October 13, 2017 08:54 AM UTC

It works, but is not a solution for me since having:

CFBundleDevelopmentRegion

es

Is just a static value and I need to change dinamically the language like we do on Android, and its working (I do the SetLocale dinamically, I did it even before your post).


Thank you.



DP David Perera October 19, 2017 04:20 PM UTC

Hello?

Can you provide a solution for changing the language dinamically on iOS?



SP Saravana Pandian Murugan Syncfusion Team October 20, 2017 03:24 AM UTC

Hi David,

We have created a new incident for the query related to Localization. Please follow incident #190410 for further updates.

Regards,
Saravana Pandian M

Loader.
Live Chat Icon For mobile
Up arrow icon