Skip to content

Call i18n.bindtextdomain with buildtime-determined locale path

Cosima Neidahl requested to merge OPNA2608/morph-browser:add/bindtextdomain into main

Because we might be installed to a prefix that is outside of the assumption LUITK makes.

In Nixpkgs/NixOS, we need this because we install every package into its own prefix. The morph-browser binary for example would end up in /nix/store/<hash>-morph-browser-<version>/bin/morph-browser, same with its locale catalogues. LUITK however assumes with its default bindtextdomain call that all locale catalogues for all applications are always available under one shared path, which isn't the case for us.

Some other core apps already have a separate i18n.bindtextdomain call which overrides this default with the application's own locale path, so I've ported that functionality over from those. Only difference is that I've opted to use GNUInstallDirs' full localedir variable instead of assuming anything about the exact path to the catalogues. The locale-installing code in the po directory already uses the localedir variable for the install location, so it made more sense to me.

Some point(s) I'm unsure about:

  • config.h has some handling for running the application outside of its target install location. I think that could be doable by adjusting the folder structure for the MO generation to match what the catalogue search is looking for, and embedding the path of the build directory into the binary to pass as i18nDirectory. Not sure if this is desirable though.

  • We don't use the Click mode in Nixpkgs, so I haven't been able to test if this breaks catalogue loading there.

Merge request reports