Skip to content

Commit

Permalink
Correctly setup the locales (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
lenemter committed Jul 20, 2023
1 parent 433c018 commit cea7ac6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*~
build/
.flatpak-builder/
10 changes: 10 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,18 @@ i18n = import('i18n')

add_global_arguments('-DGETTEXT_PACKAGE="captive-login"', '-DGCR_API_SUBJECT_TO_CHANGE', language:'c')

config_data = configuration_data()
config_data.set_quoted('LOCALEDIR', 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
)

executable(
meson.project_name(),
config_file,
'src/Application.vala',
'src/CaptiveLogin.vala',
'src/CertButton.vala',
Expand Down
7 changes: 7 additions & 0 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ public class Captive.Application : Gtk.Application {
settings = new Settings ("io.elementary.desktop.capnet-assist");
}

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

public override void activate () {
if (!settings.get_boolean ("enabled")) {
quit ();
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 cea7ac6

Please sign in to comment.