cdmikechen commented on a change in pull request #13020:
URL: https://github.com/apache/superset/pull/13020#discussion_r572906856



##########
File path: superset-frontend/src/preamble.ts
##########
@@ -40,7 +40,7 @@ if (typeof window !== 'undefined') {
   if (bootstrapData.common && bootstrapData.common.language_pack) {
     const languagePack = bootstrapData.common.language_pack;
     configure({ languagePack });
-    moment.locale(bootstrapData.common.locale);
+    moment.locale(bootstrapData.common.moment_locale);

Review comment:
       @ktmud 
   Thank you for reviewing my code!
   
   It's used in many places on `superset-front` to format time. The required 
values in current `LANGUAGES` config and `moment.js`  are inconsistent, and I 
think using `flag` as a supplement should be  ok with `moment.js`. 
   `LANGUAGES` config :
   ```python
   LANGUAGES = {
       "en": {"flag": "us", "name": "English"},
       "es": {"flag": "es", "name": "Spanish"},
       "it": {"flag": "it", "name": "Italian"},
       "fr": {"flag": "fr", "name": "French"},
       "zh": {"flag": "cn", "name": "Chinese"},
       "ja": {"flag": "jp", "name": "Japanese"},
       "de": {"flag": "de", "name": "German"},
       "pt": {"flag": "pt", "name": "Portuguese"},
       "pt_BR": {"flag": "br", "name": "Brazilian Portuguese"},
       "ru": {"flag": "ru", "name": "Russian"},
       "ko": {"flag": "kr", "name": "Korean"},
   }
   ```
   moment.js locale:
   https://github.com/moment/moment/tree/develop/locale
   
   I  wanted to add a `moment_locale` attribute in `LANGUAGES` before, but I 
don't think it's necessary for the time being, but I think the existing value 
is enough, so I adjusted the existing value.
   




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to