Skip to content

ToMetric() should have option to automatically respect locale's short/long scale preference #1675

@palenshus

Description

@palenshus

Currently ToMetric() has no option to consider the current locale's long/short-scale preference. For example, I'd like to render 1000^3 as 1 billion in an English locale and 1 milliard, but currently I'd have to manually pick the correct MetricNumeralFormats.Use[Long|Short]ScaleWord option

Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
(1000 * 1000 * 1000).ToMetric(decimals: 2); // should return "1 milliard"

Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
(1000 * 1000 * 1000).ToMetric(decimals: 2); // should return "1 milliard"

I suppose this could be a new flag, maybe called MetricNumeralFormats.UseScaleWord

There's a similar issue with the "Numbers to numbers" converter, it ignores the locale. For example:

1.25.Billions() => 1250000000

This is only true for the short-scale system

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions