Groups | Blog | Home
all groups > dotnet internationalization > august 2005 >

dotnet internationalization : Override number formatting


Chris Mahoney
8/5/2005 12:00:00 AM
Hi

I've created my webapp on my local computer, and it all works fine. The
numbers are formatted as appropriate for my country (eg. 10 000 for ten
thousand). But when I upload to my server in the US, the format changes to
the American system (10,000 for ten thousand).

I've heard that you can get around this by adding the "culture" tag to
Web.config. However, Microsoft's default settings for my country are wrong.
If I add culture="en-NZ" to the Web.config, my local computer now uses the
wrong settings too.

How can I override the settings so that the numbers appear correctly?

Thanks
Chris
Beth N
8/5/2005 11:07:43 AM
Where is the standard of using a space as the group separator for en-NZ
defined? I have not been able to find such
a standard anywhere. The Common Locale Data Repository uniformly
displays a comma as the group separator
for that locale:
http://www.unicode.org/cldr/data/diff/main/en_NZ.html

Beth


[quoted text, click to view]
Chris Mahoney
8/6/2005 12:00:00 AM
"New Zealand has adopted the SI or metric units of measurement" (from
http://www.med.govt.nz/buslt/compliance/standards/guide-2001/guide-2001-04.h
tml)

There is plenty of SI information available via Google, such as "The digits
of numerical values having more than four digits on either side of the
decimal marker are separated into groups of three using a thin, fixed space
counting from both the left and right of the decimal marker. Commas are not
used to separate digits into groups of three." (from
http://physics.nist.gov/cuu/Units/checklist.html, #16)

Anyway, this doesn't answer my question!

Chris



On 6/8/05 3:07 AM, in article OasWv9cmFHA.1464@TK2MSFTNGP14.phx.gbl, "Beth
[quoted text, click to view]
Mihai N.
8/6/2005 1:18:06 AM
[quoted text, click to view]
SI has nothing to do with the number formatting.
All Europe uses SI for a long time, but the France uses non-breaking-space
(or non-breaking-half-of-space if you are to be more catholic than the pope),
Germany uses dots and so on.

And your quote is from NIST, which is an U.S. thing.

So, the question is again: what should it be for NZ ?

--
Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Chris Mahoney
8/9/2005 12:00:00 AM
I came on here and asked how to override the number formatting. Could
someone please answer my question, rather than argue about what's right and
what's wrong.

Thank you.
Michael (michka) Kaplan [MS]
8/9/2005 4:48:15 PM
Context, please?

It is impossible to determine from the below what you are trying to do,
exactly.

But if it turns out that what you want to do is not a best practice and it
will not be good for the user of whatever you are developing, you should be
thanking the people who point it out....


--
MichKa [Microsoft]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Blog: http://blogs.msdn.com/michkap

This posting is provided "AS IS" with
no warranties, and confers no rights.


[quoted text, click to view]

Mihai N.
8/9/2005 11:43:22 PM
[quoted text, click to view]
In general I don't like teaching people how to shoot themselves (in the leg
or otherwise :-)


--
Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Chris Mahoney
8/18/2005 12:00:00 AM
Sorry about the delay in replying.

[quoted text, click to view]

Sorry, I have a bad habit of not including all the information :)

Simple line of VB code:
TextBox1.Text = String.Format("{0:c0}", 12345)

This results in the TextBox filling with "$12,345" when I want it to say
"$12 345".

[quoted text, click to view]

Look at any NZ Government publication (or many other NZ publications) and
you'll find a space as the separator.

Thanks
Chris
Michael (michka) Kaplan [MS]
8/18/2005 7:46:46 AM
You can update the numeric grouping separator in a CultureInfo's
NumberFormatInfo and then use that ci or nfi to do the formatting -- that is
the best way to proceed hee, given the code you are using (note the
String.Format override that uses an IFormatProvider -- you can pass the NFI
right there).


--
MichKa [Microsoft]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Blog: http://blogs.msdn.com/michkap

This posting is provided "AS IS" with
no warranties, and confers no rights.


[quoted text, click to view]

Chris Mahoney
8/19/2005 12:00:00 AM
Aha!

After all that trouble, I knew it'd be quite simple to do. Thanks!

Chris



On 19/8/05 2:46 AM, in article umZMoOApFHA.3544@TK2MSFTNGP15.phx.gbl,
[quoted text, click to view]
AddThis Social Bookmark Button