[gnome-shell/gnome-3-24] util: Force text direction of time strings
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gnome-3-24] util: Force text direction of time strings
- Date: Wed, 5 Jul 2017 15:08:41 +0000 (UTC)
commit 35eddb3dfad5579a13a25fb584d7041c23537227
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jun 23 17:37:13 2017 +0200
util: Force text direction of time strings
While the string returned by formatTime() should follow the locale's
text direction as a whole, the actual time part is always expected
to put hours on the left and minutes to the right. It is possible to
enforce that by inserting a left-to-right mark, but so far this is
only done by the Hebrew translation. So in order to not require all
other RTL translations to be fixed individually, just insert the
mark into the returned string ourselves like gnome-desktop's WallClock
code does[0].
[0] https://git.gnome.org/browse/gnome-desktop/tree/libgnome-desktop/gnome-wall-clock.c?h=gnome-3-24#n267
https://bugzilla.gnome.org/show_bug.cgi?id=784130
js/misc/util.js | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/js/misc/util.js b/js/misc/util.js
index d4026e2..a902aac 100644
--- a/js/misc/util.js
+++ b/js/misc/util.js
@@ -281,7 +281,10 @@ function formatTime(time, params) {
// xgettext:no-c-format
format = N_("%B %d %Y, %l\u2236%M %p");
}
- return date.format(Shell.util_translate_time_string(format));
+
+ let formattedTime = date.format(Shell.util_translate_time_string(format));
+ // prepend LTR-mark to colon/ratio to force a text direction on times
+ return formattedTime.replace(/([:\u2236])/g, '\u200e$1');
}
function createTimeLabel(date, params) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]