Skip to content

Commit

Permalink
Fix moment locale loading in bidi support
Browse files Browse the repository at this point in the history
this is the correct way to do it, especially since packaged versions of notebook are shipping without separate locale files
  • Loading branch information
jcb91 committed Nov 16, 2017
1 parent 74fbc5b commit 3f2aa86
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions notebook/static/bidi/bidi.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,10 @@ define(['bidi/numericshaping'], function(numericshaping) {
if (_isMirroringEnabled()) {
$('body').attr('dir', 'rtl');
}
var uiLang = _uiLang();

if (uiLang !== 'en' && uiLang !== 'en-us') {
// moment does not ship with a separate file for locale/en or locale/en-us
// so we must skip dynamically requiring it
requirejs(['components/moment/locale/' + _uiLang()], function(err) {
console.warn('Error loading the required locale');
console.warn(err);
});
}

require(['moment'], function (moment) {
console.log('Loaded moment locale', moment.locale(_uiLang()));
});

shaperType = _uiLang() == 'ar' ? 'national' : 'defaultNumeral';
};
Expand Down

0 comments on commit 3f2aa86

Please sign in to comment.