[panel] Detect clock AM/PM from locale
Look at whether a localized time string from JS includes am/pm to determine whether we should show it in the UI.
This commit is contained in:
parent
071efd826c
commit
c21e692652
@ -553,8 +553,15 @@ Panel.prototype = {
|
|||||||
displayDate.setMinutes(displayDate.getMinutes() + 1);
|
displayDate.setMinutes(displayDate.getMinutes() + 1);
|
||||||
msecRemaining += 60000;
|
msecRemaining += 60000;
|
||||||
}
|
}
|
||||||
|
/* If there is no am or pm, time format is 24h */
|
||||||
|
let isTime24h = displayDate.toLocaleFormat("x%p") == "x";
|
||||||
|
if (isTime24h) {
|
||||||
/* Translators: This is a time format. */
|
/* Translators: This is a time format. */
|
||||||
this._clock.set_text(displayDate.toLocaleFormat(_("%a %l:%M %p")));
|
this._clock.set_text(displayDate.toLocaleFormat(_("%a %R")));
|
||||||
|
} else {
|
||||||
|
/* Translators: This is a time format. */
|
||||||
|
this._clock.set_text(displayDate.toLocaleFormat(_("%a %k:%M %p")));
|
||||||
|
}
|
||||||
Mainloop.timeout_add(msecRemaining, Lang.bind(this, this._updateClock));
|
Mainloop.timeout_add(msecRemaining, Lang.bind(this, this._updateClock));
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user