l10n: Correctly setup the locales

This commit is contained in:
Bobby Rong 2021-08-12 21:32:39 +08:00 committed by Corentin Noël
parent 3006f63231
commit 605aa10ea2
5 changed files with 16 additions and 0 deletions

View File

@ -134,6 +134,11 @@ namespace Gala {
}
public static int main (string[] args) {
GLib.Intl.setlocale (LocaleCategory.ALL, "");
GLib.Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
GLib.Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
GLib.Intl.textdomain (Config.GETTEXT_PACKAGE);
Gtk.init (ref args);
var ctx = new OptionContext ("Gala Daemon");

View File

@ -7,5 +7,6 @@ gala_daemon_bin = executable(
'gala-daemon',
gala_daemon_sources,
dependencies: [gala_dep, gala_base_dep],
include_directories: config_inc_dir,
install: true,
)

View File

@ -22,12 +22,15 @@ endif
vapi_dir = meson.current_source_dir() / 'vapi'
locale_dir = join_paths(get_option('prefix'), get_option('localedir'))
data_dir = join_paths(get_option('prefix'), get_option('datadir'))
plugins_dir = join_paths(get_option('prefix'), get_option('libdir'), meson.project_name(), 'plugins')
pkgdata_dir = join_paths(get_option('prefix'), get_option('datadir'), meson.project_name())
pkglib_dir = join_paths(get_option('prefix'), get_option('libdir'), meson.project_name())
conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('LOCALEDIR', locale_dir)
conf.set_quoted('DATADIR', data_dir)
conf.set_quoted('PKGDATADIR', pkgdata_dir)
conf.set_quoted('PLUGINDIR', plugins_dir)

View File

@ -27,6 +27,11 @@ namespace Gala {
}
public static int main (string[] args) {
GLib.Intl.setlocale (LocaleCategory.ALL, "");
GLib.Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
GLib.Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
GLib.Intl.textdomain (Config.GETTEXT_PACKAGE);
unowned OptionContext ctx = Meta.get_option_context ();
ctx.add_main_entries (Gala.OPTIONS, null);
try {

View File

@ -18,6 +18,8 @@
[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
namespace Config
{
public const string GETTEXT_PACKAGE;
public const string LOCALEDIR;
public const string DATADIR;
public const string PKGDATADIR;
public const string VERSION;