esri feature data grid and esri legend

5009
7
01-09-2015 08:06 AM
Labels (1)
FrancoisGilbert
New Contributor

I have a simple question,

I am developing ArcGIS runtime for WPF v 10.2.3 and I want to set the language display to French for my esri:legend and esri:featuredatagrid control. How can this be done. I am currently not able to set the layer name in French for instance.

Francois

Tags (1)
0 Kudos
7 Replies
JenniferNery
Esri Regular Contributor

Hi,

For the most part, you just need to set the culture to "fr".

      Thread.CurrentThread.CurrentCulture = new CultureInfo("fr");

      Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr");

      FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

For updating the controls to be localized, you can refer to this blog post: Localizing ArcGIS Silverlight/WPF controls | ArcGIS Blog

Thanks.

Jennifer

0 Kudos
FrancoisGilbert
New Contributor

I have set the CurrentCulture to French and my WPF application (ESRI:legend) still does not display the French character. Do I have to set something in the XAML code.

Francois

0 Kudos
DominiqueBroux
Esri Frequent Contributor

The WPF controls localization is not driven by the current culture but by the language property of the controls.

As noticed by Jennifer, a WPF application that wants to use by default the user  current culture can execute this code at startup of the application:

FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement),

new FrameworkPropertyMetadata(XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));

That will set correctly the language property of all controls instantiated in your application.

However, despite, this setup some strings won't be automatically localized:

  - strings defined in XAML (for example "ClearSelection" or "Switch Selection" in FeatureDataGrid): the localization must be done by creating a custom template with the strings translated.

  - strings coming from the data or from the service: the localization must be done at server side (for example what you mean by 'I am currently not able to set the layer name in French for instance' ?)

0 Kudos
FrancoisGilbert
New Contributor

Dominique,

When I start my WPF application, I load 2 map packages. The app reads from an.ini file the name of the map package which becomes the name of the layer in the ESRI:legend.

dim oDynamicLayer as ArcGISLocalDymanicMapService

oDynamicLayer.DisplayName= "Météo"

The character "é" is not displayed in my legend control. If I use an English name, I have no problems.

François

0 Kudos
DominiqueBroux
Esri Frequent Contributor

François,

Strange. I tweaked the Legend sample in the interactiveSDK to set a French display name for the local dynamic map service layer and I didn't notice any issue:

LegendLocalization.png

I tested by setting the DisplayName in XAML and in C#. Both work.

Note: In you sample I don't get what is 'ArcGISLocalDymanicMapService'? Shouldn't be 'ArcGISLocalDymanicMapServiceLayer'?

/Dominique

0 Kudos
FrancoisGilbert
New Contributor

Dominique,

I am sorry the copy paste did not work on Iexplorer. I switched to FireFox. The good piece of code is:

Dim oDynamicLayer As New ArcGISLocalDynamicMapServiceLayer

oDynamicLayer.DisplayName = "Météo"

_________________________________________________________________________________

When I add a graphic layer called "sélection", it is working well

_SelectionGraphicslayer.DisplayName = "Sélection"

_SelectionGraphicslayer.Opacity = 1.0

_SelectionGraphicslayer.IsHitTestVisible = True

_SelectionGraphicslayer.ShowLegend = True               

MyMap.Layers().Add(_SelectionGraphicslayer)

But when I add the local map service, the french title does not display well. Both type of layer are using the same XAML format for the legend.

Dim oDynamicLayer As New ArcGISLocalDynamicMapServiceLayer

oDynamicLayer.ID = MyMap.Layers.Count - 1

oDynamicLayer.Path = sUrl

oDynamicLayer.DisplayName = ''Système hydrique''

oDynamicLayer.Opacity = dOpacity

AddHandler oDynamicLayer.Initialized, AddressOf ArcGISLocalDynamicMapServiceLayer_Initialized

AddHandler oDynamicLayer.InitializationFailed, AddressOf ArcGISLocalDynamicMapServiceLayer_InitializationFailed

MyMap.Layers().Add(oDynamicLayer)

0 Kudos
FrancoisGilbert
New Contributor

I found the problem,

I was reading the name of the layer in a text file and that file was not encoded to support the french character. The problem was in the ini file.

problem solved

0 Kudos