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
Post a Comment