Setting LC_ALL doesn't change UI language for compiled Gnome Clocks

I’m making some modifications to the Gnome Clocks app, but before I commit, I want to make sure my modifications work with other locales. I know that I can launch apps with different locales by setting LC_ALL (e.g. LC_ALL=fa_IR.utf8 gnome-clocks).

Using this to run the installed gnome-clocks works as expected, but when I try to set the locale for the app that I compiled from the git repo, only parts of the UI change. (For example, for Persian, which is an RTL language, the UI correctly gets flipped. But all the labels, except for a few city names, remain in English.)

Here’s how to recreate the problem:

  • Clone the Gnome Clocks repo and cd into it
  • meson setup build
  • cd build
  • ninja
  • LC_ALL=es_MX.utf8 ./src/gnome-clocks (you can replace this with any other locale)
  • You can see that all labels are still in English (or your current Gnome locale)

I’ve tried cleaning the build files and re-running the build sequence with the target LC_ALL environment variable, but that makes no difference.

How do I fix this? It certainly would make checking i18n in my code easier.

When not specifying an installation prefix, the default is “/usr/local”.

You then run the binary without installing the project first, so there are no translations in “/usr/local/share/locale”, and strings fall back to English.

The easiest option is to follow recommendations and use Builder (which builds, installs and runs apps from a flatpak container, i.e. isolated from the host system).

If you prefer the command line, you can use something like toolbx or distrobox to build the app in a container (so you can install it without risking to mess anything up on the host system).

Or you can actually run pkexec meson install to install the built app on your system (in /usr/local).

Another messy alternative is to configure the project with --prefix=/usr and skip the install step. You can then try to run the uninstalled app with resources from the system app. For translations that generally works, as new/changed strings will just appear untranslated; however for other resources like GSettings schemas, a mismatch likely prevents the app from running at all.

Here’s what I tried:

  • Gnome Builder (the “recommended” approach): I set LC_ALL=fa_IR.utf8 under Gnome Builder’s “configure project” > “Configurations” > “Default” > “Add Variable”. Then I ran the project, with the “Default” configuration. It didn’t work. Everything remained in English. Same thing with the org.gnome.clocks.json config.
  • Toolbx: I followed this guide to set up the toolbx environment. Then I tried installing the fa_IR locale using locale-gen, but somehow I kept getting cannot open locale definition file 'fa_IR': No such file or directory. Here’s an issue I opened on Toolbx’s repo if anyone’s interested. So this didn’t work either.
  • Distrobox: I followed the same process as toolbx to install the locale, Gnome Clocks’ dependencies, built and installed Gnome Clocks (see the guide I attached above), set LC_ALL=fa_IR.utf8, and it worked!.

I find it curious that my approach with Gnome Builder didn’t work. Not even the UI got flipped to match Persian’s RTL direction. If there’s a way to get locales working on Gnome Builder I’d very much prefer that. For now I’ll just use Distrobox when checking apps’ compatibility with different locales.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.