matheusbsilva opened a new pull request, #24263: URL: https://github.com/apache/superset/pull/24263
<!--- Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/ Example: fix(dashboard): load charts correctly --> ### SUMMARY <!--- Describe the change below, including rationale and design decisions --> Adds a configuration option to change the default language of time related data on charts, including the option to translate months. This is related to issues: #3972 , https://github.com/apache/superset/issues/13442 and https://github.com/apache/superset/issues/17447. During the implementation I had to change how the smart formatters were used across the application, because I had to ensure that they were instantiated with the right locale configuration. So instead of importing them directly, I got them through the TimeFormatterRegistry. I'm not sure if is the best option, let me know. **PS: Currently WIP because I'm fixing the tests.** ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF <!--- Skip this if not applicable --> Without time format configuration:  With brazilian portuguese time format configuration:  ### TESTING INSTRUCTIONS <!--- Required! What steps can be taken to manually verify the changes? --> Add the `D3_TIME_FORMAT` with your locale configuration to `superset_config.py` following the definition expected by D3 ([docs](https://github.com/d3/d3-time-format/tree/main#locales)), for example, this is the definition for brazilian portuguese: ```py D3_TIME_FORMAT = { "dateTime": "%A, %e de %B de %Y. %X", "date": "%d/%m/%Y", "time": "%H:%M:%S", "periods": ["AM", "PM"], "days": ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"], "shortDays": ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"], "months": ["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"], "shortMonths": ["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"] } ``` ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [X] Has associated issue: - [ ] Required feature flags: - [X] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [X] Introduces new feature or API - [ ] Removes existing feature or API -- 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]
