I have a multilanguage vb.net app.
I am trying to format a number (ULong) to display it according to current language currency group separator by doing this:
value.ToString("0.##", CultureInfo.CurrentCulture)
CultrueInfo.CurrentCulture can be english (en-GB), spanish (es-ES) or catalan (ca-ES) depending on the language selected in the app.
The problem is the following:
- If spanish (es-ES) is selected then value is not correctly
formatted as spanish language currency group separator is
','
instead of'.'
indicated in"0.##"
so I need to put"0,##"
instead.
for example 1200 is formated as is 1200 instead of 1.200
- But if I change mask to
"0,##"
then if language is set to en-GB, value is not formatted correctly as currency group separator for it is"."
instead of","
indicated in"0,##"
so I need to put"0.##"
instead.
So how to adapt mask automatically to work for all languages? detecting language and set the correct mask accordingly? but it is ok for a few language but not suitable for a lot of languages...