support English
This commit is contained in:
1 parent
138a3d15d8
commit
b8ed110459
36 files changed
+523
-118
No files matched your search
@@ -1,4 +1,10 @@
|
||||
// @ts-nocheck
|
||||
|
||||
/* เลือกชื่อเฉพาะตามภาษา: xxx_en → xxx_th (ผ่าน I18N.name ของ i18n.ts) */
|
||||
function nm(o: any, base: string): string {
|
||||
const I = (window as any).I18N;
|
||||
return I && I.name ? I.name(o, base) : ((o && o[base + '_th']) || '');
|
||||
}
|
||||
/* Ported from web-at-transit-mock/ui/partials/home.init.js — logic unchanged; bootstrap converted to mount(). */
|
||||
/* ---- ported module body ---- */
|
||||
'use strict';
|
||||
@@ -67,14 +73,14 @@
|
||||
PROVINCES.forEach(function (p) {
|
||||
var opt = document.createElement('option');
|
||||
opt.value = p.province_id;
|
||||
opt.textContent = p.province_name_th;
|
||||
opt.textContent = nm(p, 'province_name');
|
||||
if (p.province_id === startProvinceId) opt.selected = true;
|
||||
provinceSelect.appendChild(opt);
|
||||
});
|
||||
|
||||
function provinceName(id) {
|
||||
var p = PROVINCES.filter(function (x) { return x.province_id === id; })[0];
|
||||
return p ? p.province_name_th : '';
|
||||
return p ? nm(p, 'province_name') : '';
|
||||
}
|
||||
|
||||
function stationsFor(provinceId) {
|
||||
@@ -92,7 +98,7 @@
|
||||
list.forEach(function (st) {
|
||||
var opt = document.createElement('option');
|
||||
opt.value = st.station_code; /* ใช้รหัสสถานี = ลิงก์สั้น อ่านง่าย */
|
||||
opt.textContent = st.station_name_th;
|
||||
opt.textContent = nm(st, 'station_name');
|
||||
stationSelect.appendChild(opt);
|
||||
});
|
||||
|
||||
@@ -368,7 +374,7 @@
|
||||
a.innerHTML =
|
||||
'<div class="mu-card-head"><p class="mu-route-number">' + esc(r.route_id) + '</p></div>' +
|
||||
'<div class="mu-route-info">' +
|
||||
'<p class="mu-route-name">' + esc(r.route_name_th || '') + '</p>' +
|
||||
'<p class="mu-route-name">' + esc(nm(r, 'route_name')) + '</p>' +
|
||||
'<div class="mu-route-chip-wrap"></div>' +
|
||||
'</div>';
|
||||
var wrap = a.querySelector('.mu-route-chip-wrap');
|
||||
|
||||
Reference in new issue
Block a user