[gnome-terminal] gterminal: Add i18n
- From: Egmont Koblinger <egmontkob src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-terminal] gterminal: Add i18n
- Date: Sat, 14 Jun 2014 08:29:49 +0000 (UTC)
commit fd14dc6fe051d7d892cda48ce14b6fac60191d98
Author: Egmont Koblinger <egmont gmail com>
Date: Sat Jun 14 10:27:50 2014 +0200
gterminal: Add i18n
https://bugzilla.gnome.org/show_bug.cgi?id=730532
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/gterminal.vala | 107 ++++++++++++++++++++++++++--------------------------
3 files changed, 56 insertions(+), 53 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b8e04f2..af1304d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,6 +4,7 @@
gnome-terminal.appdata.xml.in
gnome-terminal.desktop.in.in
[type: gettext/glade]src/find-dialog.ui
+src/gterminal.vala
src/migration.c
src/org.gnome.Terminal.gschema.xml
[type: gettext/glade]src/preferences.ui
diff --git a/src/Makefile.am b/src/Makefile.am
index 6a9a1f9..730f445 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -190,6 +190,7 @@ gterminal_CPPFLAGS = \
-DTERMINAL_COMPILATION \
-DTERMINAL_CLIENT \
-DLOCALEDIR="\"$(datadir)/locale\"" \
+ -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
$(AM_CPPFLAGS)
# See bug #710862 about -Wsuggest-attribute=format
gterminal_CFLAGS = \
diff --git a/src/gterminal.vala b/src/gterminal.vala
index 8e76b82..10f1dec 100644
--- a/src/gterminal.vala
+++ b/src/gterminal.vala
@@ -26,9 +26,9 @@ namespace GTerminal
private static const OptionEntry[] entries = {
{ "quiet", 0, OptionFlags.HIDDEN, OptionArg.NONE, ref quiet,
- "Suppress output", null },
+ N_("Suppress output"), null },
{ "verbose", 'v', OptionFlags.HIDDEN, OptionArg.NONE, ref verbose,
- "Verbose output", null },
+ N_("Verbose output"), null },
{ null, 0, 0, 0, null, null, null }
};
@@ -40,8 +40,8 @@ namespace GTerminal
public GLib.OptionGroup get_option_group ()
{
var group = new GLib.OptionGroup ("output",
- "Output options:",
- "Show output options",
+ N_("Output options:"),
+ N_("Show output options"),
null, null);
group.add_entries (entries);
group.set_translation_domain(Config.GETTEXT_PACKAGE);
@@ -81,7 +81,7 @@ namespace GTerminal
void *unused_user_data) throws OptionError
{
if (!GLib.Application.id_is_valid (value))
- throw new OptionError.BAD_VALUE ("\"%s\" is not a valid application ID", value);
+ throw new OptionError.BAD_VALUE (_("\"%s\" is not a valid application ID"), value);
app_id = value;
return true;
}
@@ -93,15 +93,15 @@ namespace GTerminal
private static const OptionEntry[] entries = {
{ "app-id", 0, OptionFlags.HIDDEN, OptionArg.CALLBACK, (void*) option_app_id,
- "Server application ID", "ID" },
+ N_("Server application ID"), N_("ID") },
{ null, 0, 0, 0, null, null, null }
};
public static GLib.OptionGroup get_option_group ()
{
var group = new GLib.OptionGroup ("global",
- "Global options:",
- "Show global options",
+ N_("Global options:"),
+ N_("Show global options"),
null, null);
group.add_entries (entries);
group.set_translation_domain(Config.GETTEXT_PACKAGE);
@@ -124,8 +124,9 @@ namespace GTerminal
void *unused_user_data) throws Error
{
if (pass_stdin || pass_stdout || pass_stderr)
- throw new OptionError.BAD_VALUE ("FD passing of std%s is not supported",
- pass_stdin ? "in" : pass_stdout ? "out" : "err");
+ throw new OptionError.BAD_VALUE (pass_stdin ? _("FD passing of stdin is not supported") :
+ pass_stdout ? _("FD passing of stdout is not supported") :
+ _("FD passing of stderr is not supported"));
if (pass_fds == null)
return true;
@@ -137,20 +138,20 @@ namespace GTerminal
int64 v;
if (!int64.try_parse (pass_fds[i], out v) ||
v == -1 || v < int.MIN || v > int.MAX)
- throw new OptionError.BAD_VALUE ("Invalid argument \"%s\" to --fd option", pass_fds[i]);
+ throw new OptionError.BAD_VALUE (_("Invalid argument \"%s\" to --fd option"), pass_fds[i]);
int fd = (int) v;
if (fd == Posix.STDIN_FILENO ||
fd == Posix.STDOUT_FILENO ||
fd == Posix.STDERR_FILENO)
- throw new OptionError.BAD_VALUE ("FD passing of std%s is not supported",
- fd == Posix.STDIN_FILENO ? "in" :
- fd == Posix.STDOUT_FILENO ? "out" : "err");
+ throw new OptionError.BAD_VALUE (fd == Posix.STDIN_FILENO ? _("FD passing of stdin is not
supported") :
+ fd == Posix.STDOUT_FILENO ? _("FD passing of stdout is not
supported") :
+ _("FD passing of stderr is not
supported"));
for (uint j = 0; j < arr.length; j++) {
if (arr[j].fd == fd)
- throw new OptionError.BAD_VALUE ("Cannot pass FD %d twice", fd);
+ throw new OptionError.BAD_VALUE (_("Cannot pass FD %d twice"), fd);
}
var idx = fd_list.append (fd);
@@ -173,21 +174,21 @@ namespace GTerminal
private static const OptionEntry[] exec_entries = {
{ "stdin", 0, OptionFlags.HIDDEN, OptionArg.NONE, ref pass_stdin,
- "Forward stdin", null },
+ N_("Forward stdin"), null },
{ "stdout", 0, OptionFlags.HIDDEN, OptionArg.NONE, ref pass_stdout,
- "Forward stdout", null },
+ N_("Forward stdout"), null },
{ "stderr", 0, OptionFlags.HIDDEN, OptionArg.NONE, ref pass_stderr,
- "Forward stderr", null },
+ N_("Forward stderr"), null },
{ "fd", 0, 0, OptionArg.STRING_ARRAY, ref pass_fds,
- "Forward file descriptor", "FD" },
+ N_("Forward file descriptor"), N_("FD") },
{ null, 0, 0, 0, null, null, null }
};
public static GLib.OptionGroup get_exec_option_group ()
{
var group = new GLib.OptionGroup ("exec",
- "Exec options:",
- "Show exec options",
+ N_("Exec options:"),
+ N_("Show exec options"),
null, null);
group.add_entries (exec_entries);
group.set_translation_domain(Config.GETTEXT_PACKAGE);
@@ -206,22 +207,22 @@ namespace GTerminal
private static const OptionEntry[] window_entries = {
{ "maximise", 0, 0, OptionArg.NONE, ref maximise,
- "Maximise the window", null },
+ N_("Maximise the window"), null },
{ "fullscreen", 0, 0, OptionArg.NONE, ref fullscreen,
- "Full-screen the window", null },
+ N_("Full-screen the window"), null },
{ "geometry", 0, 0, OptionArg.STRING, ref geometry,
- "Set the window size; for example: 80x24, or 80x24+200+200 (COLSxROWS+X+Y)",
- "GEOMETRY" },
+ N_("Set the window size; for example: 80x24, or 80x24+200+200 (COLSxROWS+X+Y)"),
+ N_("GEOMETRY") },
{ "role", 0, 0, OptionArg.STRING, ref role,
- "Set the window role", "ROLE" },
+ N_("Set the window role"), N_("ROLE") },
{ null, 0, 0, 0, null, null, null }
};
public static GLib.OptionGroup get_window_option_group()
{
var group = new GLib.OptionGroup ("window",
- "Window options:",
- "Show window options",
+ N_("Window options:"),
+ N_("Show window options"),
null, null);
group.add_entries (window_entries);
group.set_translation_domain(Config.GETTEXT_PACKAGE);
@@ -240,7 +241,7 @@ namespace GTerminal
void *unused_user_data) throws Error
{
if (profile != null)
- throw new OptionError.BAD_VALUE ("May only use option %s once", option_name);
+ throw new OptionError.BAD_VALUE (_("May only use option %s once"), option_name);
var profiles = new Terminal.ProfilesList ();
profile = profiles.dup_uuid (value);
@@ -253,11 +254,11 @@ namespace GTerminal
{
double v;
if (!double.try_parse (value, out v))
- throw new OptionError.BAD_VALUE ("\"%s\" is not a valid zoom factor",
+ throw new OptionError.BAD_VALUE (_("\"%s\" is not a valid zoom factor"),
value);
if (v < 0.25 || v > 4.0)
- throw new OptionError.BAD_VALUE ("Zoom value \"%s\" is outside allowed range",
+ throw new OptionError.BAD_VALUE (_("Zoom value \"%s\" is outside allowed range"),
value);
zoom = v;
@@ -266,23 +267,23 @@ namespace GTerminal
private static const OptionEntry[] terminal_entries = {
{ "profile", 0, 0, OptionArg.CALLBACK, (void*) option_profile,
- "Use the given profile instead of the default profile",
- "UUID" },
+ N_("Use the given profile instead of the default profile"),
+ N_("UUID") },
{ "title", 0, 0, OptionArg.STRING, ref title,
- "Set the terminal title", "TITLE" },
+ N_("Set the terminal title"), N_("TITLE") },
{ "cwd", 0, 0, OptionArg.FILENAME, ref working_directory,
- "Set the working directory", "DIRNAME" },
+ N_("Set the working directory"), N_("DIRNAME") },
{ "zoom", 0, 0, OptionArg.CALLBACK, (void*) option_zoom,
- "Set the terminal's zoom factor (1.0 = normal size)",
- "ZOOM" },
+ N_("Set the terminal's zoom factor (1.0 = normal size)"),
+ N_("ZOOM") },
{ null, 0, 0, 0, null, null, null }
};
public static GLib.OptionGroup get_terminal_option_group ()
{
var group = new GLib.OptionGroup ("terminal",
- "Terminal options:",
- "Show terminal options",
+ N_("Terminal options:"),
+ N_("Show terminal options"),
null, null);
group.add_entries (terminal_entries);
group.set_translation_domain(Config.GETTEXT_PACKAGE);
@@ -295,15 +296,15 @@ namespace GTerminal
private static const OptionEntry[] processing_entries = {
{ "wait", 0, 0, OptionArg.NONE, ref wait_for_remote,
- "Wait until the child exits", null },
+ N_("Wait until the child exits"), null },
{ null, 0, 0, 0, null, null, null }
};
public static GLib.OptionGroup get_processing_option_group ()
{
var group = new GLib.OptionGroup ("processing",
- "Processing options:",
- "Show processing options",
+ N_("Processing options:"),
+ N_("Show processing options"),
null, null);
group.add_entries (processing_entries);
group.set_translation_domain(Config.GETTEXT_PACKAGE);
@@ -473,7 +474,7 @@ namespace GTerminal
OpenOptions.parse_argv (argv);
if (argv[0] == "run" && OpenOptions.argv_post == null)
- throw new OptionError.BAD_VALUE ("'%s' needs the command to run as arguments after '--'",
+ throw new OptionError.BAD_VALUE (_("'%s' needs the command to run as arguments after '--'"),
argv[0]);
var receiver = create_terminal ();
@@ -507,7 +508,7 @@ namespace GTerminal
private int complete (string[] argv) throws Error
{
if (argv.length < 2)
- throw new OptionError.UNKNOWN_OPTION ("Missing argument");
+ throw new OptionError.UNKNOWN_OPTION (_("Missing argument"));
if (argv[1] == "commands") {
string? prefix = argv.length > 2 ? argv[2] : null;
@@ -531,7 +532,7 @@ namespace GTerminal
return Posix.EXIT_SUCCESS;
}
- throw new OptionError.UNKNOWN_OPTION ("Unknown completion request for \"%s\"", argv[0]);
+ throw new OptionError.UNKNOWN_OPTION (_("Unknown completion request for \"%s\""), argv[0]);
}
private delegate int CommandFunc (string[] args) throws Error;
@@ -552,15 +553,15 @@ namespace GTerminal
{
Environment.set_prgname ("gterminal");
- //Intl.setlocale (LocaleCategory.ALL, "");
- //Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
- //Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
- //Intl.textdomain (Config.GETTEXT_PACKAGE);
- Environment.set_application_name ("GTerminal");
+ Intl.setlocale (LocaleCategory.ALL, "");
+ Intl.bindtextdomain (Config.GETTEXT_PACKAGE, Config.LOCALEDIR);
+ Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
+ Intl.textdomain (Config.GETTEXT_PACKAGE);
+ Environment.set_application_name (_("GTerminal"));
try {
if (argv.length == 1) {
- throw new OptionError.FAILED ("Missing command");
+ throw new OptionError.FAILED (_("Missing command"));
}
for (uint i = 0; i < commands.length; i++) {
@@ -569,11 +570,11 @@ namespace GTerminal
}
}
- throw new OptionError.FAILED ("Unknown command \"%s\"", argv[1]);
+ throw new OptionError.FAILED (_("Unknown command \"%s\""), argv[1]);
} catch (Error e) {
DBusError.strip_remote_error (e);
- printerr ("Error processing arguments: %s\n", e.message);
+ printerr (_("Error processing arguments: %s\n"), e.message);
return Posix.EXIT_FAILURE;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]