dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

How to set the Waybar clock in Spanish

Open jGarvi opened this issue 1 year ago • 16 comments

I don't know how to set the Waybar clock to Spanish. I have tried with LC_TIME but it doesn't work. Could you indicate which file I should modify to be able to set the clock to Spanish?

jGarvi avatar Nov 10 '24 14:11 jGarvi

You can set the timeformat in the dotfiles App.

mylinuxforwork avatar Nov 10 '24 14:11 mylinuxforwork

But where do I configure it. In which file, or should I create a new one. I would appreciate your help. Thank you.

jGarvi avatar Nov 10 '24 16:11 jGarvi

But where do I configure it. In which file, or should I create a new one. I would appreciate your help. Thank you.

How do you want the clock to look like? Can you share an example?

mylinuxforwork avatar Nov 10 '24 17:11 mylinuxforwork

Now in the modules.json file I have this:

"clock": { "format": " {:%H:%M - %A}", "locale": "es_ES.UTF-8", "interval": 1, "on-click": "ags -t calendar", "tooltip": false },

But it keeps showing me the day of the week in English at the bar and I want it in Spanish.

jGarvi avatar Nov 10 '24 17:11 jGarvi

Same here. I would like to have the day in fr_CA but it stays in english. Also same problem for locale folder names don't use xdg-document-portal , the scripts all use ~/Downloads but the name is not the same if you are using another locale. I have set: "locale": "fr_CA.UTF-8", in config with no success. A similar problem was open last year : https://github.com/Alexays/Waybar/issues/2694 . (Tried also fr_ca.utf-8/utf8/UTF8 with no success).

PerfMonk avatar Nov 30 '24 16:11 PerfMonk

The linked issue from @PerfMonk has the solution. For format, add the L after the first colon "format": "{:L ... }",

degobbis avatar Dec 23 '24 11:12 degobbis

For format, add the L after the first colon "format": "{:L ... }",

I tried that, but it does not work, and instead the L gets printed:

"clock": {
    "locale": "es_MX.UTF-8",
    "format": "{:L%a %d de %b  %I:%M:%S}"
}

yields LSat 28 de Dec 12:01:32

Waybar 0.9.17 from Debian 12 if it helps.

MasterGeekMX avatar Dec 28 '24 06:12 MasterGeekMX

It seems to be a Hyprland known problem.

Le sam. 28 déc. 2024 à 01:02, L. Manuel @.***> a écrit :

For format, add the L after the first colon "format": "{:L ... }",

I tried that, but it does not work, and instead the L gets printed:

"clock": { "locale": "es_MX.UTF-8", "format": "{:L%a %d de %b %I:%M:%S}"}

yields LSat 28 de Dec 12:01:32

Waybar 0.9.17 from Debian 12 if it helps.

— Reply to this email directly, view it on GitHub https://github.com/mylinuxforwork/dotfiles/issues/423#issuecomment-2564209207, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFZAWI5XWRLIDQMS2RRFN32HY5I5AVCNFSM6AAAAABRQH2XNKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRUGIYDSMRQG4 . You are receiving this because you were mentioned.Message ID: @.***>

--

Bernard Tremblay @.*** R: (418) 658-1411 C: (581) 988-1411

Le but de Linux est de gérer vos ressources et faire le travail, le but des OS propriétaire est de vous vendre d'autres licences...

PerfMonk avatar Jan 01 '25 22:01 PerfMonk

Have you enabled all the needed languages in /etc/locale.gen and generated with locale-gen? I tested it, if You do so, You can set:

"clock": {
    "locale": "es_MX.UTF-8",
    "format": "{:L%a %d de %b  %I:%M:%S}"
}

You can set a lenguage globaly in /etc/locale.conf an override it per user in ~/.config/locale.conf "locale": "es_MX.UTF-8", is not needed, if it is enabled in locale.conf, but the L ist needed to set it to the locale.

degobbis avatar Jan 02 '25 09:01 degobbis

My locale is generated correctly. I have set keyboard layout canadian french. The total OS was installed with my locale and everything works fine. The waybar clock is correctly defined : "clock": { "timezone": "America/Toronto", "locale": "fr_CA.UTF-8", "format": "{:%H:%M - %A}", "interval":1, "on-click-right": "XDG_CURRENT_DESKTOP=GNOME gnome-calendar", "tooltip-format": "{:%Y %B}\n{calendar}", "format-alt": "{:%Y-%m-%d}" }, If I type the command in a shell (kitty), I get a correct answer : date "+%H:%M-%A" returns: "00:23-vendredi" wich is my correct current time and format. The problem appears only when waybar calls for the locale, it always returns an english day name.

I can't say anything more about it.

Regards, BT

Le jeu. 2 janv. 2025 à 04:27, Guido De Gobbis @.***> a écrit :

Have you enabled all the needed languages in /etc/locale.gen and generated with locale-gen? I tested it, if You do so, You can set:

"locale": "es_MX.UTF-8",
"format": "{:L%a %d de %b  %I:%M:%S}"

}``` You can set a lenguage globaly in /etc/locale.conf an override it per user in ~/.config/locale.conf "locale": "es_MX.UTF-8", is not needed, if it is enabled in locale.conf, but the L ist needed to set it to the locale.

— Reply to this email directly, view it on GitHub https://github.com/mylinuxforwork/dotfiles/issues/423#issuecomment-2567483449, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFZAWNE3U7RERTNPHEVPJL2IUBB3AVCNFSM6AAAAABRQH2XNKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRXGQ4DGNBUHE . You are receiving this because you were mentioned.Message ID: @.***>

--

Bernard Tremblay @.*** R: (418) 658-1411 C: (581) 988-1411

Le but de Linux est de gérer vos ressources et faire le travail, le but des OS propriétaire est de vous vendre d'autres licences...

PerfMonk avatar Jan 03 '25 05:01 PerfMonk

My locale is generated correctly. I have set keyboard layout canadian french. The total OS was installed with my locale and everything works fine. The waybar clock is correctly defined :

  "clock": {
   "timezone": "America/Toronto",
   "locale": "fr_CA.UTF-8",
   "format": "{:%H:%M - %A}",
   "interval":1,
   "on-click-right": "XDG_CURRENT_DESKTOP=GNOME gnome-calendar",
          "tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
          "format-alt": "{:%Y-%m-%d}"
        },

If I type the command in a shell (kitty), I get a correct answer : date "+%H:%M-%A" returns: "00:23-vendredi" wich is my correct current time and format. The problem appears only when waybar calls for the locale, it always returns an english day name.

I can't say anything more about it.

PerfMonk avatar Jan 03 '25 05:01 PerfMonk

Your keyboard layout isn't important. It is important that fr_CA.UTF-8 is uncommented in /etc/locale.gen and generated with locale-gen. Also important is that the variable LANG is set to fr_CA.UTF-8 in /etc/locale.conf. The command locale should reflect this.

If this is the case, this configuration should be sufficient:

  "clock": {
   "timezone": "America/Toronto",
   "format": "{:L%H:%M - %A}",
   "interval":1,
   "on-click-right": "XDG_CURRENT_DESKTOP=GNOME gnome-calendar",
          "tooltip-format": "<big>{:L%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
          "format-alt": "{:%Y-%m-%d}"
        },

degobbis avatar Jan 03 '25 10:01 degobbis

All is correctly set. I have removed the "locale" line in the clock module (as it was before...) but the date is still showed in english. On recent systemd there is no /etc/locale.gen file, you must use localectl. It is correctly set as you can see here:

[root@fido etc]# localectl
System Locale: LANG=fr_CA.UTF-8
    VC Keymap: ca
   X11 Layout: ca
    X11 Model: pc105
[root@fido etc]# 

But the waybar clock still show "Sunday" in english instead of "Dimanche" in french. It's very mysterious .

PerfMonk avatar Jan 06 '25 01:01 PerfMonk

Perhaps we also use different distros. I use Arch and have de-DE.UTF-8 as default and also use Systemd.

Without the process with locale-gen it doesn't work for me either, but if I enter de-DE.UTF-8 and fr_CA.UTF-8 in the file /etc/locale.gen and then run locale-gen as root, I can change the clock in the waybar.

So if that doesn't work for you, or your distro doesn't support locale-gen, I don't know what to do right now.

grafik

degobbis avatar Jan 06 '25 07:01 degobbis

I'm on Fedora 41 with gnome and hyprland installed. Modern distro using systemd will all eventually stop using locale.gen. It is now controlled by a systemd tool : localectl. see my locale here:

localectl status
System Locale: LANG=fr_CA.UTF-8
    VC Keymap: ca
   X11 Layout: ca
    X11 Model: pc105

I have no /etc/locale.gen but there is a /etc/locale.conf (containing only : LANG="fr_CA.UTF-8").

The issue is not related to locale configuration but on waybar not using the selected locale within the clock widget.

PerfMonk avatar Jan 11 '25 22:01 PerfMonk

Debian GNU/Linux 12 (bookworm) x86_64 Laptop 13 (AMD Ryzen 7040Series) A7

System Locale: LANG=es_ES.UTF-8
    VC Keymap: (unset)         
   X11 Layout: es
    X11 Model: pc105

Trying

"format": {:L%a %d %b %Y %H:%M:%S}

prints the 'L' character in front of the english formatted string

Removing this line:

"timezone": <Country>/<City>"

fixes the issue for me

I'm on SDT -06:00 however so I don't know if that would work for other time zones

fuguesoft avatar Jan 13 '25 06:01 fuguesoft