Globalization and Measurement Units
-
Is there a way to determine the measurement units for a given locale using CultureInfo class or some other item in the framework? Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra
-
Is there a way to determine the measurement units for a given locale using CultureInfo class or some other item in the framework? Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra
Not that I know of - a quick check of MSDN and it seems that setting is mysteriously missing from the CultureInfo class where one would expect it... however what kind of "measurement units" do you need? Just, for example, metric vs imperial units? (the setting for "Metric" or "U.S." If so, I'd recommend just giving the user the choice, or if it's not an application where that "makes sense", I'd personally be quite comfortable with hardcoding it to: US = US imperial units Liberia = US imperial units Burma = US imperial units UK = Depends on types of units you're talking about, maybe imperial, maybe metric (officially metric, but they're a strange bunch!) Anywhere else = Metric units If you're talking about other measurement, such as how to display the date string or currency or whatever, you CAN get that from CultureInfo, but I guess you already knew that...
-
Not that I know of - a quick check of MSDN and it seems that setting is mysteriously missing from the CultureInfo class where one would expect it... however what kind of "measurement units" do you need? Just, for example, metric vs imperial units? (the setting for "Metric" or "U.S." If so, I'd recommend just giving the user the choice, or if it's not an application where that "makes sense", I'd personally be quite comfortable with hardcoding it to: US = US imperial units Liberia = US imperial units Burma = US imperial units UK = Depends on types of units you're talking about, maybe imperial, maybe metric (officially metric, but they're a strange bunch!) Anywhere else = Metric units If you're talking about other measurement, such as how to display the date string or currency or whatever, you CAN get that from CultureInfo, but I guess you already knew that...
Ok, just as I thought. I have to do temperature conversions, not really a taxing affair but I like to do things in an extensible way. I have done a fairly substantial internationalization project before, but the units were specified by the company as some industry specific types, that had only one exception for Russia. I just coughed up the unit value and let the rest of the formatting be done by the CultureInfo class. Getting the measurement units would be a nice addition to that class. I'll probably hard code or maybe derive a custom CultureInfo type to include your list. Thanks for the info, I appreciate the help. Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra
-
Not that I know of - a quick check of MSDN and it seems that setting is mysteriously missing from the CultureInfo class where one would expect it... however what kind of "measurement units" do you need? Just, for example, metric vs imperial units? (the setting for "Metric" or "U.S." If so, I'd recommend just giving the user the choice, or if it's not an application where that "makes sense", I'd personally be quite comfortable with hardcoding it to: US = US imperial units Liberia = US imperial units Burma = US imperial units UK = Depends on types of units you're talking about, maybe imperial, maybe metric (officially metric, but they're a strange bunch!) Anywhere else = Metric units If you're talking about other measurement, such as how to display the date string or currency or whatever, you CAN get that from CultureInfo, but I guess you already knew that...
I stand corrected X| . That information is available in the RegionInfo class as it has an IsMetric property. I guess it makes sense if you think about the difference between what CultureInfo and RegionInfo should represent. Never thought to look in there... I almost never use that class. Thanks again. Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra
-
I stand corrected X| . That information is available in the RegionInfo class as it has an IsMetric property. I guess it makes sense if you think about the difference between what CultureInfo and RegionInfo should represent. Never thought to look in there... I almost never use that class. Thanks again. Scott P
“It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.” -Edsger Dijkstra