Skip to content

Commit b3b8106

Browse files
authored
Merge pull request #3048 from jcb91/bidi
Fix moment locale loading in bidi support
2 parents afd5aea + 60b7c22 commit b3b8106

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

notebook/static/bidi/bidi.js

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,27 @@ define(['bidi/numericshaping'], function(numericshaping) {
55
'use strict';
66

77
var shaperType = '';
8-
var textDir = '';
98

109
var _uiLang = function() {
1110
return navigator.language.toLowerCase();
1211
};
1312

1413
var _loadLocale = function() {
1514
if (_isMirroringEnabled()) {
16-
$('body').attr('dir', 'rtl');
17-
}
18-
var uiLang = _uiLang();
19-
20-
if (uiLang !== 'en' && uiLang !== 'en-us') {
21-
// moment does not ship with a separate file for locale/en or locale/en-us
22-
// so we must skip dynamically requiring it
23-
requirejs(['components/moment/locale/' + _uiLang()], function(err) {
24-
console.warn('Error loading the required locale');
25-
console.warn(err);
26-
});
15+
document.body.dir = 'rtl';
2716
}
2817

18+
require(['moment'], function (moment) {
19+
console.log('Loaded moment locale', moment.locale(_uiLang()));
20+
});
21+
2922
shaperType = _uiLang() == 'ar' ? 'national' : 'defaultNumeral';
3023
};
3124

3225
var _isMirroringEnabled = function() {
3326
return new RegExp('^(ar|he)').test(_uiLang());
3427
};
3528

36-
/**
37-
* NS : for digit Shaping.
38-
* BTD : for future work in case of Base Text Direction Addition.
39-
*/
40-
4129
/**
4230
* @param value : the string to apply the bidi-support on it.
4331
* @param flag :indicates the type of bidi-support (Numeric-shaping ,Base-text-dir ).

0 commit comments

Comments
 (0)