admin管理员组

文章数量:1026989

I've been trying to localize default number formatting in Apache Superset charts, specifically the SI suffixes used in formats like .2s. Out of the box, Superset uses D3 defaults — k, M, B — but I need to show them in Russian: тыс., млн, млрд. What I’ve tried so far:

Changing Babel locale — partially localizes the interface, but does not affect number formatting.

Edited this file:

superset-frontend/node_modules/@superset-ui/core/src/number-format/factories/createD3NumberFormatter.ts

Injected a wrapper around .2s using .replace('k', ' тыс.'), etc.

Ran npm run build

Rebuilt with docker-compose -f docker-compose-non-dev.yml up -d --build

No effect in the UI, even on new charts

Tried registering a custom formatter in setupFormatters.ts:

getNumberFormatterRegistry().registerValue('RU_SHORT', d3Format('.2s'))

But Superset throws:
430227735890.2086 (Invalid format: RU_SHORT)

I also reviewed this article: Unfortunately, it doesn’t address SI suffix localization at all.

What I’m looking for:

Is there an official or stable way to override or localize SI suffixes in Superset?

Where is the correct hook — D3, @superset-ui/core, registry patching?

Has anyone successfully implemented localized short formats like .2s → 5 тыс., 20 млн, 8.3 млрд?

Any guidance, examples, or community experience would be appreciated

I've been trying to localize default number formatting in Apache Superset charts, specifically the SI suffixes used in formats like .2s. Out of the box, Superset uses D3 defaults — k, M, B — but I need to show them in Russian: тыс., млн, млрд. What I’ve tried so far:

Changing Babel locale — partially localizes the interface, but does not affect number formatting.

Edited this file:

superset-frontend/node_modules/@superset-ui/core/src/number-format/factories/createD3NumberFormatter.ts

Injected a wrapper around .2s using .replace('k', ' тыс.'), etc.

Ran npm run build

Rebuilt with docker-compose -f docker-compose-non-dev.yml up -d --build

No effect in the UI, even on new charts

Tried registering a custom formatter in setupFormatters.ts:

getNumberFormatterRegistry().registerValue('RU_SHORT', d3Format('.2s'))

But Superset throws:
430227735890.2086 (Invalid format: RU_SHORT)

I also reviewed this article: Unfortunately, it doesn’t address SI suffix localization at all.

What I’m looking for:

Is there an official or stable way to override or localize SI suffixes in Superset?

Where is the correct hook — D3, @superset-ui/core, registry patching?

Has anyone successfully implemented localized short formats like .2s → 5 тыс., 20 млн, 8.3 млрд?

Any guidance, examples, or community experience would be appreciated

本文标签: