From b3da2b67bdb1b1788149a7dc4f9cb0d6c48ed551 Mon Sep 17 00:00:00 2001 From: Ryo Nakano Date: Sat, 5 Oct 2024 10:53:18 +0900 Subject: [PATCH] l10n: Setup locales correctly --- src/Application.vala | 5 +++++ src/config.vala.in | 1 + src/meson.build | 1 + 3 files changed, 7 insertions(+) diff --git a/src/Application.vala b/src/Application.vala index c5e78631..1683646e 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -33,6 +33,11 @@ public class Sequeler.Application : Gtk.Application { application_id = Constants.PROJECT_NAME; flags |= ApplicationFlags.HANDLES_OPEN; + GLib.Intl.setlocale (LocaleCategory.ALL, ""); + GLib.Intl.bindtextdomain (Constants.GETTEXT_PACKAGE, Constants.LOCALEDIR); + GLib.Intl.bind_textdomain_codeset (Constants.GETTEXT_PACKAGE, "UTF-8"); + GLib.Intl.textdomain (Constants.GETTEXT_PACKAGE); + schema = new Secret.Schema (Constants.PROJECT_NAME, Secret.SchemaFlags.NONE, "id", Secret.SchemaAttributeType.INTEGER, "schema", Secret.SchemaAttributeType.STRING); diff --git a/src/config.vala.in b/src/config.vala.in index 2606fc91..797f35bc 100644 --- a/src/config.vala.in +++ b/src/config.vala.in @@ -1,5 +1,6 @@ namespace Constants { public const string PROJECT_NAME = "@PROJECT_NAME@"; public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@"; + public const string LOCALEDIR = "@LOCALEDIR@"; public const string VERSION = "@VERSION@"; } diff --git a/src/meson.build b/src/meson.build index efb8fe74..2ce8eb11 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1,6 +1,7 @@ conf_data = configuration_data() conf_data.set('PROJECT_NAME', application_id) conf_data.set('GETTEXT_PACKAGE', meson.project_name()) +conf_data.set('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir'))) conf_data.set('VERSION', meson.project_version()) config_header = configure_file(