zoukankan      html  css  js  c++  java
  • odoo Uncaught TypeError: locale() locale is not loaded from moment locales!

    解决方法:

    • 修改addons/web/static/lib/moment/moment.js

      • 修改前
      function loadLocale(name) {
          var oldLocale = null;
          // TODO: Find a better way to register and load all the locales in Node
          if (!locales[name] && (typeof module !== 'undefined') &&
              module && module.exports) {
              try {
                  oldLocale = globalLocale._abbr;
                  require('./locale/' + name);
                  // because defineLocale currently also sets the global locale, we
                  // want to undo that for lazy loaded locales
                  getSetGlobalLocale(oldLocale);
              } catch (e) {
              }
          }
          return locales[name];
      }
      
      • 修改后
      function loadLocale(name) {
          var oldLocale = null;
          // TODO: Find a better way to register and load all the locales in Node
          if (!locales[name] && (typeof module !== 'undefined') &&
              module && module.exports) {
              try {
                  oldLocale = globalLocale._abbr;
                  require('./locale/' + name);
                  // because defineLocale currently also sets the global locale, we
                  // want to undo that for lazy loaded locales
                  getSetGlobalLocale(oldLocale);
              } catch (e) {
              }
          }
      //-------------------------------------------------
          if (locales[name] === undefined) {
              locales[name] = locales['en'];
          }
      //-------------------------------------------------
          return locales[name];
      }
      
    • 这里的locales['en'], 是在报错页面运行moment.locale()得到的

  • 相关阅读:
    书签
    身份证查询
    Swiper 中文API手册(share)
    seo查询命令
    前端开发薪资之各地区对比(图文分析)(share)
    新浪微博AppKey大集合(share)
    PHP乱码问题,UTF-8(乱码) (share)
    JavaScript 获取数组中最大值、最小值
    设为首页 添加到收藏夹 (share)
    javascript数组 去重
  • 原文地址:https://www.cnblogs.com/edhg/p/11987419.html
Copyright © 2011-2022 走看看