c# - Localization using CultureInfo - punctuation marks -


i use cultureinfo in order localize application:

cultureinfo newculture = new cultureinfo("en-us"); thread.currentthread.currentculture = newculture; thread.currentthread.currentuiculture = newculture; 

i encountered problem has punctuation marks: in local database (from i'm getting useful data app) latitude , longitude properties stored dots (i.e. 45.245135) , that's fine when cultureinfo set en-us. however, when switch native language (where dot perceived thousand mark) none of map functions can work.

i'd difficult if change each bit of code handles these values, it's everywhere more or less.

any ideas on solving that?

try working invariantculture whenever convert to/from string:

  string stlattitude = "45.245135";   ...    // string double   // culture.invariantculture make conversion culture independent   double lattitude = double.parse(stlattitude, culture.invariantculture);   ...   // double string   // culture.invariantculture make conversion culture independent   string strlattitude = lattitude.tostring(culture.invariantculture); 

use currentculture when you're showing final result user

  // showing user: that's why currentculture (default) used   show(lattitude.tostring()); 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -