×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Registered User
    Join Date
    Mar 2013
    Posts
    15

    Changing Language of Reverse Geocode response ? [Localization]

    Hi All,

    Is there any way by using Nokia Maps and ReverseGeocodeQuery API to retrieve location details such as country name and street details in language other than "English" such as "Arabic" ?

  2. #2
    Nokia Developer Champion
    Join Date
    Sep 2012
    Location
    Morocco
    Posts
    297

    Re: Changing Language of Reverse Geocode response ? [Localization]

    Hello,

    it's done automatically, if your phone is using the french language you'll get french name and street, if a name don't exist in a specified language you will get it in the universal one (english).

    PS : I don't know if you can force it to use a language programmatically, maybe in the OnQueryCompleted doing something like e.Result.ToString( new System.Globalization.CultureInfo("ar") ) but I didn't test if it works.

  3. #3
    Registered User
    Join Date
    Mar 2013
    Posts
    15

    Re: Changing Language of Reverse Geocode response ? [Localization]

    Quote Originally Posted by Loukt View Post
    Hello,

    it's done automatically, if your phone is using the french language you'll get french name and street, if a name don't exist in a specified language you will get it in the universal one (english).

    PS : I don't know if you can force it to use a language programmatically, maybe in the OnQueryCompleted doing something like e.Result.ToString( new System.Globalization.CultureInfo("ar") ) but I didn't test if it works.
    Thanks Loukt
    it worked as you expected when I changed phone language but the other way of forcing that way didn't work
    Code:
     
    
     MapAddress address = e.Result[0].Information.Address;
                       
    CurrentLocTextBlock.Text = "Current Location: City " + address.City.ToString(new System.Globalization.CultureInfo("ar-EG"));
    Is there any other since the data itself is available at Nokia server side ?

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    565

    Re: Changing Language of Reverse Geocode response ? [Localization]

    as Loukt mentions, ReverseGeocodeQuery automatically returns the address in the language the phone is set to, it's a simple API and doesn't have many options.

    If you want to go the custom route, which will require writing more code but will give you more flexibility, then I'd recommend the Google Geocoding API. A language can be specified as part of the paramater.

    I'd recommend making a JSON request with WebClient/GZipWebClient and use ServiceStack.Text for the JSON parsing.

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2011
    Location
    Portugal
    Posts
    957

    Re: Changing Language of Reverse Geocode response ? [Localization]

    You can try and change the thread culture at the beginning of the app. This can only be done at first launch, and if the user want to change the location will have to exit the app and start again.

    On the method:

    Code:
    private void InitializePhoneApplication()
    Add this:

    Code:
        Thread.CurrentThread.CurrentCulture = new CultureInfo("pt-PT");
        Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
    pt-PT stands for Portuguese. You can try others.

    Please mind that I didn't tested this with the maps controls. Let us know hot it goes.

  6. #6
    Registered User
    Join Date
    Mar 2013
    Posts
    15

    Re: Changing Language of Reverse Geocode response ? [Localization]

    Quote Originally Posted by joaocardoso View Post
    You can try and change the thread culture at the beginning of the app. This can only be done at first launch, and if the user want to change the location will have to exit the app and start again.

    On the method:

    Code:
    private void InitializePhoneApplication()
    Add this:

    Code:
        Thread.CurrentThread.CurrentCulture = new CultureInfo("pt-PT");
        Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
    pt-PT stands for Portuguese. You can try others.

    Please mind that I didn't tested this with the maps controls. Let us know hot it goes.
    Thanks João

    I've tried your solution it didn't work although it recognizes the Arabic language in my case and it's even changed the direction of app from left to right to "right yo left" but it still shows data in English language (Default or currently set settings)

    I afraid that Nokia API for Maps working on OS level not application level you know any anfo about that ??

  7. #7
    Nokia Developer Moderator
    Join Date
    Feb 2011
    Location
    Portugal
    Posts
    957

    Re: Changing Language of Reverse Geocode response ? [Localization]

    Quote Originally Posted by Mohab_Tarek View Post
    Thanks João

    I've tried your solution it didn't work although it recognizes the Arabic language in my case and it's even changed the direction of app from left to right to "right yo left" but it still shows data in English language (Default or currently set settings)

    I afraid that Nokia API for Maps working on OS level not application level you know any anfo about that ??
    Tried myself and I can see that it still defaults to the language of the OS.

    Then only option I can think of is for you to use translation. Its a bit of a "hack" but I've seen similar implementations and while not perfect, are usually a good compromise.

    You can have a jumpstart on the subject here: http://blogs.msdn.com/b/translation/...owsphone8.aspx

    Edit: Just realized something. What you want is to have the street writen in Arabic, not translated to Arabic, right?

  8. #8
    Nokia Developer Champion
    Join Date
    Jul 2012
    Posts
    88

    Re: Changing Language of Reverse Geocode response ? [Localization]

    I think he wants the name of the street/city in arabic.
    Since the native ReverseGeoCode API uses the system language (which is not acceptable in your case) I suggest you use the Nokia Restful Api (which wil require internet access) and add the Accept-Language Parameter:
    Code:
    http://demo.places.nlp.nokia.com/places/v1/discover/here?tf=plain&size=10&at=37.7851%2C-7.4047&app_code=NYKC67ShPhQwqaydGIW4yg&app_id=demo_qCG24t50dHOwrLQ&Accept=Application/json&Accept-Language=ar-ma
    You'll find the reverse geocode data Under the "context" tag

  9. #9
    Registered User
    Join Date
    Mar 2013
    Posts
    15

    Re: Changing Language of Reverse Geocode response ? [Localization]

    Quote Originally Posted by joaocardoso View Post
    Tried myself and I can see that it still defaults to the language of the OS.

    Then only option I can think of is for you to use translation. Its a bit of a "hack" but I've seen similar implementations and while not perfect, are usually a good compromise.

    You can have a jumpstart on the subject here: http://blogs.msdn.com/b/translation/...owsphone8.aspx

    Edit: Just realized something. What you want is to have the street writen in Arabic, not translated to Arabic, right?
    Absolutely right Joao that what I want I don't know why they did't expose a parameter that accepts taking culture language if data is already exist on their servers weird !!

  10. #10
    Registered User
    Join Date
    Mar 2013
    Posts
    15

    Re: Changing Language of Reverse Geocode response ? [Localization]

    Quote Originally Posted by WPMorocco View Post
    I think he wants the name of the street/city in arabic.
    Since the native ReverseGeoCode API uses the system language (which is not acceptable in your case) I suggest you use the Nokia Restful Api (which wil require internet access) and add the Accept-Language Parameter:
    Code:
    http://demo.places.nlp.nokia.com/places/v1/discover/here?tf=plain&size=10&at=37.7851%2C-7.4047&app_code=NYKC67ShPhQwqaydGIW4yg&app_id=demo_qCG24t50dHOwrLQ&Accept=Application/json&Accept-Language=ar-ma
    You'll find the reverse geocode data Under the "context" tag
    As you said that what I wanted but this Api seems not powerful enough and completed as native ReverseGeoCode the other one returns postal code and street names nearly all data in correct language plus I'm afraid that Nokia retiring that restful for sake of newly Here maps.
    Any Info how I can use this service in case i decided using it ??

  11. #11
    Nokia Developer Champion
    Join Date
    Sep 2012
    Location
    Morocco
    Posts
    297

    Re: Changing Language of Reverse Geocode response ? [Localization]

    Quote Originally Posted by Mohab_Tarek View Post
    Any Info how I can use this service in case i decided using it ??
    This service is HERE, simply create an account on developer.here.net then create a new projet et get new appid/key for you application, and use the link WPMorocco gave you. all you'll have to do then is some json parsing.

  12. #12
    Nokia Developer Champion
    Join Date
    Jul 2012
    Posts
    88

    Re: Changing Language of Reverse Geocode response ? [Localization]

    Quote Originally Posted by Mohab_Tarek View Post
    Any Info how I can use this service in case i decided using it ??
    This will return a simple json, you can parse it Easily using the NewtonSoft Json.net library and get the info you're looking for.

  13. #13
    Registered User
    Join Date
    Mar 2013
    Posts
    15

    Re: Changing Language of Reverse Geocode response ? [Localization]

    Quote Originally Posted by WPMorocco View Post
    This will return a simple json, you can parse it Easily using the NewtonSoft Json.net library and get the info you're looking for.
    Quote Originally Posted by Loukt View Post
    This service is HERE, simply create an account on developer.here.net then create a new projet et get new appid/key for you application, and use the link WPMorocco gave you. all you'll have to do then is some json parsing.
    Thanks a lot guys for your help

Similar Threads

  1. Localization in other language
    By honest_success in forum Mobile Java General
    Replies: 1
    Last Post: 2009-05-13, 16:20
  2. Default language for localization
    By -chris- in forum Symbian
    Replies: 20
    Last Post: 2008-10-02, 20:23
  3. Localization Lao language for Nokia phones
    By laonux in forum Mobile Java Tools & SDKs
    Replies: 1
    Last Post: 2006-08-08, 06:43
  4. About Language code for localization
    By Poyo_shiu in forum Symbian
    Replies: 1
    Last Post: 2006-06-28, 11:35
  5. Asian Language (Japanese/Chinese) localization fonts
    By georgechen in forum Mobile Java General
    Replies: 1
    Last Post: 2006-05-24, 01:42

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×