对于我正在研究的框架,我尝试将moment-with-locales.js,moment.js包装起来并将Js组合在一起 . 如果我在不使用requireJs的情况下直接运行时刻和时刻 - 工作正常 . 当我使用requireJs运行时,语言环境不起作用 . 有没有理由为什么语言环境不起作用?

require.config({
    baseUrl: '.',
    paths: {
        'jQuery': '../path to jQuery plugin',
        'moment': '../path to moment js plugin',
        'momentLocale':'../path to moment locale js plugin',
        'momentTimeZone':'../path to moment timezone js plugin'
    },
    shim: {
        'moment': {
            deps: ['jQuery']
        },
        'momentLocale': {
            deps: ['moment']
        }
    }
});

这是JavaScript页面

define([
    'jQuery',
    'moment',
    'momentLocale'],
    function(
        $,
        moment,
        momentLocale ) {
        getLocaleForCal: function(region) {
            switch(region): {
                case "af_NA":
                case "af_ZA":
                    return "af";
                break;
                default:
                    return "en";
                break;
            }
         }
     };
  });

$(function() {
    var currentRegion = this.getLocaleForCal("af_NA");
    $("#datetimepicker2").datetimepicker({
        locale: moment.locale(currentRegion)
    });
});