Skip to content

Commit 65515c2

Browse files
authored
l10n: Setup locales (#36)
1 parent e426b1b commit 65515c2

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

meson.build

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,18 @@ i18n = import('i18n')
88

99
add_global_arguments('-DGETTEXT_PACKAGE="@0@"'.format (meson.project_name()), language:'c')
1010

11+
config_data = configuration_data()
12+
config_data.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
13+
config_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
14+
config_file = configure_file(
15+
input: 'src/Config.vala.in',
16+
output: '@BASENAME@',
17+
configuration: config_data
18+
)
19+
1120
executable(
1221
meson.project_name(),
22+
config_file,
1323
'src/Application.vala',
1424
'src/MainWindow.vala',
1525
'src/IndividualView.vala',

src/Application.vala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ public class Friends.Application : Gtk.Application {
6464
}
6565

6666
public static int main (string[] args) {
67+
Intl.setlocale (LocaleCategory.ALL, "");
68+
Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
69+
Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
70+
Intl.textdomain (GETTEXT_PACKAGE);
71+
6772
var app = new Application ();
6873
return app.run (args);
6974
}

src/Config.vala.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@;
2+
public const string LOCALEDIR = @LOCALEDIR@;

0 commit comments

Comments
 (0)