status/system: Use Intl to format battery percentage
The exact way of formatting a percentage value is locale specific: https://en.wikipedia.org/wiki/Percent_sign#Correct_style. We account for that by marking the string for translations, but then get it wrong for the default US locale (go us!). But given that the javascript engine itself provides us with a way of formatting a percentage in a locale-specific way, that seems the better option than putting the burden on our own developers and translators. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7005 Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2966>
This commit is contained in:
parent
2baa298e39
commit
6f7f0f369b
@ -93,8 +93,9 @@ const PowerToggle = GObject.registerClass({
|
||||
use_default_fallbacks: false,
|
||||
});
|
||||
|
||||
const formatter = new Intl.NumberFormat(undefined, {style: 'percent'});
|
||||
this.set({
|
||||
title: _('%d\u2009%%').format(this._proxy.Percentage),
|
||||
title: formatter.format(this._proxy.Percentage / 100),
|
||||
fallback_icon_name: this._proxy.IconName,
|
||||
gicon,
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user