Skip to content

Commit

Permalink
Add PREFIX and APPNAME in Build class and enable translations.
Browse files Browse the repository at this point in the history
  • Loading branch information
be1 committed Feb 21, 2024
1 parent a17f3c2 commit 79e947f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ conf = configuration_data()
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
conf.set_quoted('VERSION', meson.project_version())
conf.set_quoted('PKGDATADIR', join_paths(get_option('datadir'), meson.project_name()))
conf.set_quoted('PREFIX', get_option('prefix'))
conf.set_quoted('APPNAME', meson.project_name())
configure_file(output: 'config.h', configuration: conf)
config_h_dir = include_directories('.')

Expand Down
6 changes: 5 additions & 1 deletion src/Agenda.vala
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Agenda {
}

public Agenda () {
Object (application_id: "com.github.dahenson.agenda",
Object (application_id: Build.APPNAME == "agenda" ? null : Build.APPNAME,
flags: ApplicationFlags.FLAGS_NONE);
}

Expand Down Expand Up @@ -69,6 +69,10 @@ namespace Agenda {
}

public static int main (string[] args) {
Intl.setlocale (GLib.LocaleCategory.ALL, "");
Intl.bindtextdomain (Build.APPNAME, Build.PREFIX + "/share/locale");
Intl.textdomain (Build.APPNAME);

app = new Agenda ();

if (args[1] == "-s") {
Expand Down
2 changes: 2 additions & 0 deletions vapi/config.vapi
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[CCode (cprefix = "", lower_case_cprefix = "", cheader_filename = "config.h")]
namespace Build {
public const string APPNAME;
public const string PREFIX;
public const string PKGDATADIR;
public const string VERSION;
}

0 comments on commit 79e947f

Please sign in to comment.