stuartlangridge / gnome-shell-clock-override

Override the Gnome Shell clock with a new time format or text of your choice. Works with new versions of Shell such as 3.18
MIT License
89 stars 33 forks source link

Add ability to change locale #38

Closed thebitstick closed 5 years ago

thebitstick commented 5 years ago

I want the ability to have my GNOME in one language and my clock in another. Is that possible for an extension to do?

da2x commented 5 years ago

This extension only works with the clock at the top of GNOME. I'll not add specific settings for changing the locale for only this one part of the desktop.

You can set the date and time locale on your system by changing the LC_TIME environmental variable on your system, however. Here are instructions for changing this on Ubuntu. Instructions vary by distro and you'll probably find instructions for your distribution elsewhere online.

shungo27 commented 2 years ago
  1. Open the Clock override settings.
  2. Set "Text to display insteed of the clock" to ${m[%-m]} %d ${w[%w]} %R. ${m[%-m]} is the month and ${w[%w]} is the day of the week.
  3. Add the following two lines under var settings;
    const w = new Array('Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.');
    const m = new Array('', 'Jan.', 'Feb.', 'Mar.', 'Apr.', 'May', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.');
  4. Rewrite var FORMAT = settings.get_string("override-string"); to
    var FORMAT = "`" + settings.get_string("override-string") + "`";
  5. Rewrite var desired = Format.format(FORMAT, now); to
    var desired = eval(Format.format(FORMAT, now));
  6. Press alt + f2, type r, and press Enter to restart gnome-shell.

Note that this change will be reset when the Clock override is updated.