6

When I change the language of the phone to any language (say French), the labels in the map change to French.

Is it possible to force a language in Map Control? I tried to use "Language" property of the Map and change it to "fr" & "fr-FR". It didnt work.

Ateik
  • 2,458
  • 4
  • 39
  • 59
  • i'm sorry my understanding was that you wanna change given text – Swift Sharp May 09 '13 at 13:11
  • What do you mean by labels? Are you referring to street names and such or something else? – Alaa Masoud May 13 '13 at 17:54
  • Yes, the street names the cities ... etc. If you change the language of the phone itself, you get them. But I dont want the user to change the system's language. – Ateik May 13 '13 at 18:43

3 Answers3

3

actually it's quite simple

if you wanna change the global language:

private void Application_Launching(object sender, LaunchingEventArgs e)
        {                      
           Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fr-FR");
           Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");          
        }

private void Application_Activated(object sender, ActivatedEventArgs e)
        {                     
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fr-FR");
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR");          
        }

if you wanna to get single resource:

CultureInfo c = new System.Globalization.CultureInfo("fr-FR");
var m = AppResources.ResourceManager.GetString(AppResources.MapControlTitle,c));

where AppResourse is your resource (resx) file, and AppResources.MapControlTitle is the label that wanna get.

happy coding (:

EDIT

can you try this:

Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fr-FR"); YourMapControl.Language = System.Windows.Markup.XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentCulture.Name);

Swift Sharp
  • 2,604
  • 3
  • 30
  • 54
1

You can try with the current Culture of the Thread.

Try to reinitialize the culture

System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fr-CH"); // For French Language ( or "fr-FR" )

before your Map Control Initialization.

In Theory, The Thread will be Reinitialized with the french Culture. ^^

Doc Roms
  • 3,288
  • 1
  • 20
  • 37
  • Okay, Sorry for the "not-help" . If you find solution, please, share it :) I'm interested :) – Doc Roms May 13 '13 at 09:42
  • I'm not sure, that your answer is here [Nokia Map Website](http://www.developer.nokia.com/Community/Wiki/Portal:Windows_Phone_Location_%26_Maps) but it's the official webSite for Nokia Map developper. – Doc Roms May 13 '13 at 10:08
1

Probably not the answer you were hoping for, but the Map Control will always honor the operating system's locale settings.

Patrick F
  • 1,201
  • 8
  • 11
  • Can you get me an msdn link or something? – Ateik May 19 '13 at 06:12
  • That's the point, there isn't any. This is by design. Unlike on a PC, for many reasons - namely privacy and security reasons, it's impossible to override a multitude of operating system settings (including locale) in the WP8 world. – Patrick F May 20 '13 at 21:20