Repository navigation
Expand file tree
/
Copy pathglobalization.js
More file actions
86 lines (83 loc) · 2.9 KB
/
Copy pathglobalization.js
File metadata and controls
86 lines (83 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
this.default = function () {
var L10n = ej.base.L10n;
L10n.load({
'de': {
'daterangepicker': {
placeholder: 'Einen Bereich auswählen',
startLabel: 'Anfangsdatum',
endLabel: 'Enddatum',
applyText: 'Sich bewerben',
cancelText: 'Stornieren',
selectedDays: 'Ausgewählte Tage',
days: 'Tage',
customRange: 'benutzerdefinierten Bereich'
}
},
'en': {
'daterangepicker': {
placeholder: 'Select a range ',
startLabel: 'Start Date',
endLabel: 'End Date',
applyText: 'Apply',
cancelText: 'Cancel',
selectedDays: 'Selected Days',
days: 'Days',
customRange: 'Custom Range'
}
},
'ar': {
'daterangepicker': {
placeholder: 'حدد نطاقا',
startLabel: 'تاريخ البدء',
endLabel: 'تاريخ الانتهاء',
applyText: 'تطبيق',
cancelText: 'إلغاء',
selectedDays: 'الأيام المحددة',
days: 'أيام',
customRange: 'نطاق مخصص'
}
}
});
var daterangepicker = new ej.calendars.DateRangePicker({
locale: 'de'
});
daterangepicker.appendTo('#daterangepicker');
loadCultureFiles('de');
var dropObj = new ej.dropdowns.DropDownList({
width: '100%',
change: cultureChange,
value: 'de'
});
dropObj.appendTo('#cultures');
function cultureChange() {
var culture = this.text;
daterangepicker.locale = culture;
daterangepicker.enableRtl = daterangepicker.locale === 'ar' ? true : false;
if (culture !== 'en') {
loadCultureFiles(culture);
}
}
function loadCultureFiles(name) {
var files = ['ca-gregorian.json', 'numbers.json', 'timeZoneNames.json'];
if (name === 'ar') {
files.push('numberingSystems.json');
}
var loader = ej.base.loadCldr;
var loadCulture = function (prop) {
var val, ajax;
if (name === 'ar' && prop === files.length - 1) {
ajax = new ej.base.Ajax(location.origin + location.pathname + 'src/common/cldr-data/supplemental/' + files[prop], 'GET', false);
} else {
ajax = new ej.base.Ajax(location.origin + location.pathname + 'src/common/cldr-data/main/' + name + '/' + files[prop], 'GET', false);
}
ajax.onSuccess = function (value) {
val = value;
};
ajax.send();
loader(JSON.parse(val));
};
for (var prop = 0; prop < files.length; prop++) {
loadCulture(prop);
}
}
};