diff --git a/data/com.github.ryonakano.reco.appdata.xml b/data/com.github.ryonakano.reco.appdata.xml.in similarity index 100% rename from data/com.github.ryonakano.reco.appdata.xml rename to data/com.github.ryonakano.reco.appdata.xml.in diff --git a/data/com.github.ryonakano.reco.desktop b/data/com.github.ryonakano.reco.desktop.in similarity index 100% rename from data/com.github.ryonakano.reco.desktop rename to data/com.github.ryonakano.reco.desktop.in diff --git a/data/meson.build b/data/meson.build index def7f990..f104b7a6 100644 --- a/data/meson.build +++ b/data/meson.build @@ -1,10 +1,17 @@ -install_data( - 'com.github.ryonakano.reco.desktop', +i18n.merge_file( + input: 'com.github.ryonakano.reco.desktop.in', + output: 'com.github.ryonakano.reco.desktop', + po_dir: join_paths(meson.source_root(), 'po', 'extra'), + type: 'desktop', + install: true, install_dir: join_paths(get_option('datadir'), 'applications') ) -install_data( - 'com.github.ryonakano.reco.appdata.xml', +i18n.merge_file( + input: 'com.github.ryonakano.reco.appdata.xml.in', + output: 'com.github.ryonakano.reco.appdata.xml', + po_dir: join_paths(meson.source_root(), 'po', 'extra'), + install: true, install_dir: join_paths(get_option('datadir'), 'metainfo') ) diff --git a/meson.build b/meson.build index 6df9ac40..b667e47e 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,12 @@ project('com.github.ryonakano.reco', 'vala', 'c') gnome = import('gnome') +i18n = import('i18n') + +add_project_arguments( + '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()), + language: 'c' +) asresources = gnome.compile_resources( 'as-resources', @@ -26,5 +32,6 @@ executable( ) subdir('data') +subdir('po') meson.add_install_script('meson/post_install.py') diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 00000000..e69de29b diff --git a/po/POTFILES b/po/POTFILES new file mode 100644 index 00000000..84f62ecc --- /dev/null +++ b/po/POTFILES @@ -0,0 +1,4 @@ +src/Views/WelcomeView.vala +src/Views/RecordView.vala +src/Application.vala +src/MainWindow.vala diff --git a/po/com.github.ryonakano.reco.pot b/po/com.github.ryonakano.reco.pot new file mode 100644 index 00000000..de1211bc --- /dev/null +++ b/po/com.github.ryonakano.reco.pot @@ -0,0 +1,47 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the com.github.ryonakano.reco package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: com.github.ryonakano.reco\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-01 16:57+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: src/Views/WelcomeView.vala:35 +msgid "Format:" +msgstr "" + +#: src/Views/WelcomeView.vala:42 +msgid "Delay in seconds:" +msgstr "" + +#: src/Views/WelcomeView.vala:58 +msgid "Start recording" +msgstr "" + +#: src/Views/RecordView.vala:51 +msgid "Stop recording" +msgstr "" + +#: src/Views/RecordView.vala:78 +msgid "Unable to Create an Audio File" +msgstr "" + +#: src/Views/RecordView.vala:78 +msgid "A gstreamer error happened while recording:" +msgstr "" + +#: src/Views/RecordView.vala:78 +#, c-format +msgid "Error: %s" +msgstr "" diff --git a/po/extra/LINGUAS b/po/extra/LINGUAS new file mode 100644 index 00000000..e69de29b diff --git a/po/extra/POTFILES b/po/extra/POTFILES new file mode 100644 index 00000000..df92486f --- /dev/null +++ b/po/extra/POTFILES @@ -0,0 +1,2 @@ +data/com.github.ryonakano.reco.appdata.xml.in +data/com.github.ryonakano.reco.desktop.in diff --git a/po/extra/extra.pot b/po/extra/extra.pot new file mode 100644 index 00000000..944b244b --- /dev/null +++ b/po/extra/extra.pot @@ -0,0 +1,64 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the extra package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: extra\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-12-01 16:57+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: data/com.github.ryonakano.reco.appdata.xml.in:7 +#: data/com.github.ryonakano.reco.desktop.in:3 +msgid "Reco" +msgstr "" + +#: data/com.github.ryonakano.reco.appdata.xml.in:8 +#: data/com.github.ryonakano.reco.desktop.in:5 +msgid "Record talk to remember its content later" +msgstr "" + +#: data/com.github.ryonakano.reco.appdata.xml.in:10 +msgid "An audio recording app that lets you recall things talked later." +msgstr "" + +#: data/com.github.ryonakano.reco.appdata.xml.in:13 +msgid "Useful when:" +msgstr "" + +#: data/com.github.ryonakano.reco.appdata.xml.in:15 +msgid "you join a discussion and take your minutes later" +msgstr "" + +#: data/com.github.ryonakano.reco.appdata.xml.in:16 +msgid "you want to record talk with your friends or lover" +msgstr "" + +#: data/com.github.ryonakano.reco.appdata.xml.in:18 +msgid "Features include:" +msgstr "" + +#: data/com.github.ryonakano.reco.appdata.xml.in:20 +msgid "Timed recording" +msgstr "" + +#: data/com.github.ryonakano.reco.appdata.xml.in:59 +msgid "Ryo Nakano" +msgstr "" + +#: data/com.github.ryonakano.reco.desktop.in:4 +msgid "Audio Recording App" +msgstr "" + +#: data/com.github.ryonakano.reco.desktop.in:8 +msgid "com.github.ryonakano.reco" +msgstr "" diff --git a/po/extra/meson.build b/po/extra/meson.build new file mode 100644 index 00000000..ddcaf1c8 --- /dev/null +++ b/po/extra/meson.build @@ -0,0 +1,7 @@ +i18n.gettext('extra', + args: [ + '--directory=' + meson.source_root (), + '--from-code=UTF-8' + ], + install: false +) diff --git a/po/meson.build b/po/meson.build new file mode 100644 index 00000000..6c860ca7 --- /dev/null +++ b/po/meson.build @@ -0,0 +1,8 @@ +i18n.gettext(meson.project_name(), + args: [ + '--directory=' + meson.source_root (), + '--from-code=UTF-8' + ] +) + +subdir('extra') diff --git a/src/Views/RecordView.vala b/src/Views/RecordView.vala index 4cab0d4c..c535c016 100644 --- a/src/Views/RecordView.vala +++ b/src/Views/RecordView.vala @@ -48,7 +48,7 @@ public class RecordView : Gtk.Box { stop_button = new Gtk.Button (); stop_button.image = new Gtk.Image.from_icon_name ("media-playback-stop-symbolic", Gtk.IconSize.DND); - stop_button.tooltip_text = "Stop recording"; + stop_button.tooltip_text = _("Stop recording"); stop_button.get_style_context ().add_class ("record-button"); stop_button.halign = Gtk.Align.CENTER; stop_button.margin_top = 12; @@ -75,7 +75,7 @@ public class RecordView : Gtk.Box { msg.parse_error (out err, out debug); is_recording = false; - var error_dialog = new Granite.MessageDialog.with_image_from_icon_name ("Unable to Create an Audio File", "A gstreamer error happened while recording:" + "\n%s\n\n".printf (err.message) + "Error: %s".printf (debug) + "\n", "dialog-error", Gtk.ButtonsType.CLOSE); + var error_dialog = new Granite.MessageDialog.with_image_from_icon_name (_("Unable to Create an Audio File"), _("A gstreamer error happened while recording:") + "\n%s\n\n".printf (err.message) + _("Error: %s").printf (debug) + "\n", "dialog-error", Gtk.ButtonsType.CLOSE); error_dialog.transient_for = window; error_dialog.run (); error_dialog.destroy (); diff --git a/src/Views/WelcomeView.vala b/src/Views/WelcomeView.vala index c8299f93..0833c270 100644 --- a/src/Views/WelcomeView.vala +++ b/src/Views/WelcomeView.vala @@ -32,14 +32,14 @@ public class WelcomeView : Gtk.Box { construct { // Create settings widgets - var format_label = new Gtk.Label ("Format:"); + var format_label = new Gtk.Label (_("Format:")); format_label.xalign = 1; // TODO: Make it possible to record with various formats format_combobox = new Gtk.ComboBoxText (); format_combobox.append ("wav", "Wav"); format_combobox.active_id = "wav"; - var delay_label = new Gtk.Label ("Delay in seconds:"); + var delay_label = new Gtk.Label (_("Delay in seconds:")); delay_label.xalign = 1; delay_spin = new Gtk.SpinButton.with_range (0, 15, 1); @@ -55,7 +55,7 @@ public class WelcomeView : Gtk.Box { // Create buttons record_button = new Gtk.Button (); record_button.image = new Gtk.Image.from_icon_name ("audio-input-microphone-symbolic", Gtk.IconSize.DND); - record_button.tooltip_text = "Start recording"; + record_button.tooltip_text = _("Start recording"); record_button.get_style_context ().add_class ("record-button"); record_button.halign = Gtk.Align.CENTER; record_button.margin_top = 12;