Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bojan 16 posts 131 karma points
    Sep 08, 2016 @ 12:10
    Bojan
    0

    Latitude and longitude are with comma on a German language

    Hi to all,

    I'm using the 2.0.1 version and I noticed one issue (it took me 4h but who cares). I have a multilanguage site, and when I change to German version properties like Latitude and Longitude are with a comma (19,44534) and not point as it should be (19.44534). Google map stays greyed out as it can't parse those values.

    I will try to update to 2.0.3, maybe this is already fixed.

    Thanks, Bojan

  • Bojan 16 posts 131 karma points
    Sep 08, 2016 @ 12:25
    Bojan
    0

    I managed to fixed this issue by using ToString() to always translate to a specific culture, otherwise, it would translate decimal properties to comma version if you leave them in a razor with the active German language.

    <div class="map" id="map" data-longitude="@Model.Content.ShopLocation.Longitude.ToString(CultureInfo.CreateSpecificCulture("en-GB"))" data-latitude="@Model.Content.ShopLocation.Latitude.ToString(CultureInfo.CreateSpecificCulture("en-GB"))" data-zoom="@Model.Content.ShopLocation.Zoom"></div>
    

    Maybe this will help somebody.

  • Jonathan Richards 288 posts 1742 karma points MVP
    Sep 08, 2016 @ 14:39
    Jonathan Richards
    0

    Hi Bojan

    Thank you for your information, I just wanted to make others aware if they read your post that this issue has nothing to do with how Angular Google Maps displays or stores values internally (Its uses Invariant Culture throughout), but this issue is to do with how Razor displays a decimal value type - this is really is your responsibility and depends how you wish to consume the decimal values.

    eg. @Model.Content.ShopLocation.Longitude and @Model.Content.ShopLocation.Latitude are decimal types and its up to you how you turn them into strings. Just in the same way, as a date being stored in a DateTime date type is your responsibility how you convert to a string.

    Cheers

    Jonathan

Please Sign in or register to post replies

Write your reply to:

Draft