Skip to content

Commit

Permalink
Merge pull request #46 from ryonakano/setup-l10n
Browse files Browse the repository at this point in the history
l10n: Fix translation not loaded in Flatpak
  • Loading branch information
ChildishGiant authored Dec 2, 2023
2 parents eda445f + 8cec4e4 commit 86045ca
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
9 changes: 9 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ add_project_arguments(
language: 'vala'
)

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
)

# Listing dependencies
dependencies = [
Expand All @@ -35,6 +43,7 @@ subdir ('src')
# Executable
executable (
meson.project_name (),
config_file,
sources,
dependencies: dependencies,
install: true
Expand Down
2 changes: 1 addition & 1 deletion po/POTFILES
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
src/MainWindow.vala
src/AlertView.vala
src/Application.vala
src/MainWindow.vala
5 changes: 5 additions & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ public class Mixer.App : Gtk.Application {
};

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

add_main_option_entries (OPTIONS);
}

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 86045ca

Please sign in to comment.