ceenayekta commented on code in PR #33189:
URL: https://github.com/apache/superset/pull/33189#discussion_r2278766889
##########
superset/constants.py:
##########
@@ -203,6 +203,25 @@ class RouteMethod: # pylint:
disable=too-few-public-methods
| EXTRA_FORM_DATA_OVERRIDE_EXTRA_KEYS
)
+LOCALES_LANGUAGE_MAP = {
+ "en": "en_US",
+ "es": "es_ES",
+ "it": "it_IT",
+ "fr": "fr_FR",
+ "zh": "zh_CN",
+ "zh_TW": "zh_TW",
+ "ja": "ja_JP",
+ "de": "de_DE",
+ "pt": "pt_PT",
+ "pt_BR": "pt_BR",
+ "ru": "ru_RU",
+ "ko": "ko_KR",
+ "sk": "sk_SK",
+ "sl": "sl_SI",
+ "nl": "nl_NL",
+ "uk": "uk_UA",
+}
+
Review Comment:
That's a good point.
I checked all 3 files you mentioned. Here are the points I can think of:
1- `LOCALE_MAPPING` in `superset-frontend/src/hooks/useLocale.ts` is
applying locales on `DatePicker` and `RangePicker` components, by passing
locale object to `AntdThemeProvider` and passed to `ConfigProvider` of `antd`.
2- The enum declared in `LocaleCode` in
`superset-frontend/packages/superset-ui-core/src/components/Table/cell-renderers/NumericCell/index.tsx`
is only preventing hard-coding locale values in cell formatting. Also, there
aren't much usages of this enum except in stories and test files.
3- The map I added is located on a python file, with the idea of mapping the
`locale in flask` into `humanize i18n locale argument`.
I'm personally a fan of DRY, but I'm not sure how to unify them in a single
file, as they have individual usages.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]