You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/10/25 04:09:32 UTC

[GitHub] [echarts] plainheart commented on a change in pull request #15935: fix(calendar): i18n isn't working in calendar coordinate system

plainheart commented on a change in pull request #15935:
URL: https://github.com/apache/echarts/pull/15935#discussion_r735243830



##########
File path: src/component/calendar/CalendarView.ts
##########
@@ -509,16 +506,26 @@ class CalendarView extends ComponentView {
         let margin = dayLabel.get('margin');
         const firstDayOfWeek = coordSys.getFirstDayOfWeek();
 
-        if (zrUtil.isString(nameMap)) {
-            nameMap = WEEK_TEXT[nameMap.toUpperCase() as 'CN' | 'EN'] || [];
+        if (!nameMap || isString(nameMap)) {
+            if (nameMap) {
+                // case-sensitive
+                localeModel = getLocaleModel(nameMap as string) || localeModel;
+            }
+            debugger
+            // Use the capital of `dayOfWeekAbbr` if `dayOfWeekShort` doesn't exist in the locale file.
+            const dayOfWeekShort = localeModel.get(['time', 'dayOfWeekShort']);

Review comment:
       @pissang It merges the default en locale object into the registered locale object. https://github.com/apache/echarts/blob/master/src/core/locale.ts#L62
   
   So we may need to add the new `dayOfWeekShort` option to each locale file, or at least to the `ZH` locale file. Otherwise, there will be an type issue in https://github.com/apache/echarts/blob/master/src/core/locale.ts#L80 and the following code
   ```js
   map(localeModel.get(['time', 'dayOfWeekAbbr']), val => val[0]);
   ```
   won't be invoked.




-- 
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: commits-unsubscribe@echarts.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org