forked from syncfusion/ej2-aspnetcore-samples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGlobalization.cshtml
133 lines (119 loc) · 4.4 KB
/
Globalization.cshtml
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
@using Syncfusion.EJ2
@section ControlsSection{
<div class=" col-lg-8 control-section">
<div class="timepicker-section">
<div id="wrapper" class="timepicker-control">
<div class="tabs-wrap">
<div class="wrap">
<ejs-timepicker id="timepicker" placeholder="Select Time"></ejs-timepicker>
</div>
</div>
</div>
</div>
</div>
<div class="col-lg-4 property-section">
<div class="radio-control" id="property" title="Select a Locale">
<div class="row">
<ejs-radiobutton id="en" name="locale" label="English" value="en" change="cultureChange"></ejs-radiobutton>
</div>
<div class="row">
<ejs-radiobutton id="de" name="locale" label="German" value="de" change="cultureChange" checked="true"></ejs-radiobutton>
</div>
<div class="row">
<ejs-radiobutton id="ar" name="locale" label="Arabic" value="ar" change="cultureChange"></ejs-radiobutton>
</div>
</div>
</div>
}
<script>
document.addEventListener('DOMContentLoaded', function () {
timepicker = document.getElementById('timepicker').ej2_instances[0];
var L10n = ej.base.L10n;
L10n.load({
'de': {
'timepicker': { placeholder: 'Wählen Sie Zeit' }
},
'zh': {
'timepicker': { placeholder: '選擇時間' }
},
'vi': {
'timepicker': { placeholder: 'Chọn thời gian' }
},
'en': {
'timepicker': { placeholder: 'Select Time' }
},
'ar': {
'timepicker': { placeholder: 'حدد الوقت' }
}
});
loadCultureFiles('de');
timepicker.locale = 'de';
});
function cultureChange(args) {
var culture = args.value;
timepicker.locale = culture;
if (culture !== 'en') {
loadCultureFiles(culture);
}
timepicker.enableRtl = (timepicker.locale === 'ar');
}
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 + '/../../scripts/cldr-data/supplemental/' + files[prop], 'GET', false);
} else {
ajax = new ej.base.Ajax(location.origin + location.pathname + '/../../scripts/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);
}
}
</script>
@*custom code start*@
<style>
#wrapper {
max-width: 246px;
margin: 30px auto;
padding-top: 20px;
}
.property-section {
width: 200px;
}
</style>
@*custom code end*@
@section ActionDescription{
<div id="action-description">
<p>
In this sample, the TimePicker has been configured with
<code>German</code> culture. To change this current culture, go to the properties panel at the right side and select a culture from
available options. For mobile mode touch the icon at the right side and select a culture from the available options.
</p>
</div>
}
@section Description{
<div id="description">
<p>
TimePicker component was rendered with
<code>German</code> culture. Here, the time separator and time format are specific to the current culture.
</p>
<p>
You can also change the component culture by selecting it from the culture options in the properties panel.
</p>
<p>
More information on the globalization and it's configuration can be found in the
<a href="https://ej2.syncfusion.com/aspnetcore/documentation/base/intl.html" target="_blank"> documentation section</a>.
</p>
</div>
}