Skip to content

Commit

Permalink
Merge pull request #64 from ryonakano/ryonakano/setup-l10n
Browse files Browse the repository at this point in the history
l10n: Correctly setup the locales
  • Loading branch information
louis77 authored Aug 25, 2021
2 parents 4a80f33 + 027282e commit bed6534
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ add_project_arguments (
language: 'c'
)

config_data = configuration_data()
config_data.set_quoted('LOCALEDIR', join_paths(get_option('prefix'), get_option('localedir')))
config_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
config_file = configure_file(
input: 'src/Config.vala.in',
output: '@BASENAME@',
configuration: config_data
)

# Compiling resources
asresources = gnome.compile_resources (
'as-resources',
Expand Down Expand Up @@ -50,6 +59,7 @@ subdir ('src')
executable (
meson.project_name (),
asresources,
config_file,
sources,
dependencies: dependencies,
install: true
Expand Down
5 changes: 5 additions & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public class Tuner.Application : Gtk.Application {
}

construct {
GLib.Intl.setlocale (LocaleCategory.ALL, "");
GLib.Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
GLib.Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
GLib.Intl.textdomain (GETTEXT_PACKAGE);

settings = new GLib.Settings (this.application_id);
player = new PlayerController ();

Expand Down
2 changes: 2 additions & 0 deletions src/Config.vala.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@;
public const string LOCALEDIR = @LOCALEDIR@;

0 comments on commit bed6534

Please sign in to comment.