mirror of
https://github.com/wassname/fullcalendar.git
synced 2026-06-27 16:10:13 +08:00
moment-2.8 compatibility, language file generation
This commit is contained in:
+1
-1
@@ -123,7 +123,7 @@ module.exports = function(grunt) {
|
||||
]);
|
||||
|
||||
config.generateLanguages = {
|
||||
moment: 'lib/moment/lang/',
|
||||
moment: grunt.file.expand('lib/moment/{locale,lang}/')[0], // lang directory is pre-moment-2.8
|
||||
datepicker: 'lib/jquery-ui/ui/i18n/',
|
||||
fullCalendar: 'lang/',
|
||||
dest: 'build/temp/lang/',
|
||||
|
||||
@@ -36,7 +36,7 @@ module.exports = function(grunt) {
|
||||
});
|
||||
|
||||
// code for resetting the language back to English
|
||||
combinedJS += '\nmoment.lang("en");';
|
||||
combinedJS += '\n(moment.locale || moment.lang).call(moment, "en");'; // works with moment-pre-2.8
|
||||
combinedJS += '\n$.fullCalendar.lang("en");';
|
||||
combinedJS += '\nif ($.datepicker) $.datepicker.setDefaults($.datepicker.regional[""]);';
|
||||
|
||||
@@ -133,9 +133,11 @@ module.exports = function(grunt) {
|
||||
}
|
||||
);
|
||||
|
||||
js = js.replace( // replace the `return` statement so execution continues
|
||||
/^(\s*)return moment\.lang\(/m,
|
||||
'$1moment.lang('
|
||||
// replace the `return` statement so execution continues
|
||||
// compatible with moment-pre-2.8
|
||||
js = js.replace(
|
||||
/^(\s*)return moment\.(defineLocale|lang)\(/m,
|
||||
'$1(moment.defineLocale || moment.lang).call(moment, '
|
||||
);
|
||||
|
||||
return js;
|
||||
|
||||
Reference in New Issue
Block a user