Localized exponential notation?

I am trying to convert numbers to localized strings.

For integers and monetary values, this is quite simple, since a string is just a series of numbers and separators for grouping numbers. For example:.

  • 12 345 678 901 (Bulgarian)
  • 12.345.678.901 (Catalan)
  • 12,345,678,901 (in English)
  • 12,34,56,78,901 (Hindi)
  • 12.345.678.901 (frieze)
  • 12?345?678?901 (Pashto)
  • 12'345'678'901 (German)

I use the GetNumberFormat function to format integers (and GetCurrencyFormat to format monetary values).

But some numbers cannot be reasonably represented in fixed notation and require scientific notation :

  • 6.0221417930 × 10 23

or more specifically E-notation :

  • 6.0221417930E23

How can I get a localized version of scientific notation?

Suppose I could build it using localized numbers:

 6.0221417930E23 6,0221417930E23 6.0221417930e23 6·0221417930E23 6·0221417930e23 6,0221417930e23 6,,0221417930e23 6.0221417930E+23 6,0221417930E+23 6.0221417930e+23 6,0221417930e+23 6·0221417930E+23 6·0221417930e+23 6,,0221417930e+23 6.0221417930E23 6,0221417930E23 6.0221417930e23 6,0221417930e23 6·0221417930E23 6·0221417930e23 6,,0221417930e23 6.0221417930X10^23 6,0221417930X10^23 6.0221417930x10^23 6,0221417930x10^23 6·0221417930X10^23 6·0221417930x10^23 6,,0221417930x10^23 6.0221417930·10^23 6,0221417930·^23 6.0221417930.10^23 6,0221417930.10^23 6·0221417930·^23 6·0221417930.10^23 6,,0221417930.10^23 

but I don’t know if other cultures (cultures other than mine) use E for exponentiation.

+7
source share
2 answers

As far as I know, exposure notation is not part of the Windows or .NET locale data. However, the Unicode CLDR may help again : the <numbers> sections contain what you are looking for:

/numbers/symbols/exponential says E or its equivalent in a given culture.

/numbers/scientificFormats/ shows the exponential pattern.

You will need to download the ZIP file data with the archived keys and extract the file for each culture of interest to you from common/main .

If you want to support all cultures, you will need to collect the relevant information from all culture files and pack it into your specific database. Not quite a trivial job, but it's possible.

I quickly looked through the data in several different cultures, such as en, fr, zh, ru, vi, ar: They all contain the same pattern: #E0 . It seems that the data is not accurate (I seriously doubt it.), Or you don't need to really care: everyone does the same, and you shouldn't really care.

+4
source

In Polish, this should be 6.0221417930 · 10 23 .
I don't think the CLDR mentioned by Serge (BTW's excellent answer) is here. However, it is still the best source of information. Otherwise, you will need to ask your translators to translate the template for you (which will require a comment with a good explanation of what you are doing).

0
source

All Articles