[Compilation] Show: 25+9 = 34

2022-12-19   ES  

When developing with Vite + Moment, the date selector cannot be normally internationalized. It may be that you use the Import ‘Moment/LOCALE/zh-cn’ directly from the translation package introduced from the/local folder to Import ‘Moment /distal/local/zh-cn ‘to introduce translation files from the/different folder

// Import 'Moment/LOCALE/ZH-CN'; 
 Import 'Moment/Dist/Locale/ZH-CN'; // Use Moment/SRC/LOCALE/ZH-CN

The reason, let’s open these two translation packages to compare their differences:

first look at Moment \ LOCALE \ zh-cn.js, we see that this is a UMD version:

// moment \ locale \ zh-cn.js 
 ; (Function (Global, Factory) { 
     Typeof Exports === 'Object' && Typeof Module! == 'Undefined' && Typeof Require === 'Function' 
     What's more? 
     Factory (Require ('../ Moment')) 
     Intersection 
         Typeof Define === 'Function' && Define.amd 
         What's more? 
         define (['../ Moment'], Factory) 
         Intersection 
         Factory (global.moment) 
 } (this, (function (moment) {'use strict'; 

     //! Moment.js locale configuration 

     var zhcn = Moment.definelocale ('zh-cn', { 
         Months: 'January_Elected_Elected _ March_Embly -May _ June _ July_Au August_Sepan _ October _ December _ December (' _ '), 
         monthsshort: 'January _ February _ March_Elected _ May _ June _ July _ September _ October _ November _ December' .split ('_'), 
         weekdays: 'Sunday_ Monday_ Tuesday_Wedon _ Thursday_ Thursday _ Saturday' .split ('_'), 
         weekdaysshort: 'Sunday_ Monday_Sperture _ Thursday _ Thursday _ Friday _ Saturday' .split ('_'), 
         weekdaysmin: 'day 
         longdateFormat: {...}, 
         Meridiemparse: /Morning | morning | morning | Noon | Innate /evening /, 
         Meridiemhour: Function (Hour, Meridiem) {...}, 
         Meridiem: Function (Hour, Minute, Islower) {...}, 
         Calendar: {...}, 
         dayofmonthordinalpars: /\ d {1,2} (day | month | week) /, 
         Ordinal: Function (Number, Period) {...}, 
         Relativetime: {...}, 
         Week: {...}, 
     }); 

     Return zhcn; 

 }));

Take a look at Moment \ SRC \ LOCALE \ zh-cn.js, obviously an ESM dependencies:

// moment \ src \ local \ zh-cn.js 
 Import mom from '../moment'; 

 export default moment.definelocale ('zh-cn', { 
         Months: 'January_Elected_Elected _ March_Embly -May _ June _ July_Au August_Sepan _ October _ December _ December (' _ '), 
         monthsshort: 'January _ February _ March_Elected _ May _ June _ July _ September _ October _ November _ December' .split ('_'), 
         weekdays: 'Sunday_ Monday_ Tuesday_Wedon _ Thursday_ Thursday _ Saturday' .split ('_'), 
         weekdaysshort: 'Sunday_ Monday_Sperture _ Thursday _ Thursday _ Friday _ Saturday' .split ('_'), 
         weekdaysmin: 'day 
         longdateFormat: {...}, 
         Meridiemparse: /Morning | morning | morning | Noon | Innate /evening /, 
         Meridiemhour: Function (Hour, Meridiem) {...}, 
         Meridiem: Function (Hour, Minute, Islower) {...}, 
         Calendar: {...}, 
         dayofmonthordinalpars: /\ d {1,2} (day | month | week) /, 
         Ordinal: Function (Number, Period) {...}, 
         Relativetime: {...}, 
         Week: {...}, 
 });

What should I do? Let’s take a look at the solution given by the big brothers:

https://github.com/vitejs/vite/issues/945#issuecomment-715393989

You understand me … no, do you understand what he meant?

source

Related Posts

CiteSpace Learning Notes & Experience ALAN

Detailed explanation of probability graph model -there is a direction figure model: Bayesian network

java Study on the first day 2021.7.19

[Computer vision] Restore the structural SFM-camera motion estimated from the motion, 3D reconstruction [2D point sequence]

[Compilation] Show: 25+9 = 34

Random Posts

2020 Internet: 10 more reliable forecasts

qt The method of reading files a

UVA122 Question Report Aleks

Operation pandas to implement one-hot in a column

Machine Learning-Three Pandas04