You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "villebro (via GitHub)" <gi...@apache.org> on 2023/04/21 06:42:34 UTC

[GitHub] [superset] villebro commented on a diff in pull request #20075: feat: custom d3 number locale

villebro commented on code in PR #20075:
URL: https://github.com/apache/superset/pull/20075#discussion_r1173362701


##########
superset-frontend/src/types/bootstrapTypes.ts:
##########
@@ -150,6 +151,7 @@ export interface CommonBootstrapData {
   extra_sequential_color_schemes: SequentialSchemeConfig[];
   theme_overrides: JsonObject;
   menu_data: MenuData;
+  d3_format: Partial<FormatLocaleDefinition>;

Review Comment:
   Do we really need `Partial` here? It appears that the added `dict` in `config.py` defines all properties of `FormatLocaleDefinition`. If not, let's make sure the type in `config.py` reflects the partialness.



##########
superset/config.py:
##########
@@ -377,6 +377,18 @@ def _try_json_readsha(filepath: str, length: int) -> Optional[str]:
 # incomplete and not well maintained.
 LANGUAGES = {}
 
+
+# Override the default d3 locale format
+# Default values are equivalent to
+# D3_FORMAT = {
+#     "decimal": ".",           # - decimal place string (e.g., ".").
+#     "thousands": ",",         # - group separator string (e.g., ",").
+#     "grouping": [3],          # - array of group sizes (e.g., [3]), cycled as needed.
+#     "currency": ["$", ""]     # - currency prefix/suffix strings (e.g., ["$", ""])
+# }
+# https://github.com/d3/d3-format/blob/main/README.md#formatLocale
+D3_FORMAT: Dict[str, Any] = {}

Review Comment:
   nit: as `TypedDict` is now a default thing in our currently supported Python versions, I'd prefer to create a `D3Format(TypedDict)` for this.



-- 
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: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org