diff options
author | Thomas Haller <thaller@redhat.com> | 2017-12-21 14:36:00 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-04-13 10:11:16 +0200 |
commit | 9a675ba82ac0a22c81d5492595098af76bf39915 (patch) | |
tree | ef5e4991934f3aa4419f41ed6607b1bc9fe3e525 /src/main.c | |
parent | 684bf311502a0579d841bb55137f42368ae0cc6b (diff) | |
download | NetworkManager-th/various-cleanup.tar.gz |
core: don't localize strings for daemonth/various-cleanup
NetworkManager deamon does not run in the context of the
(client) user, hence it usually has no explicit locale set. Even if
a admin configures a locale for system daemons, it is not necessarily
the right locale in the client context.
Getting localization of strings right would be important. For example,
when a request fails, the error message should be in the language of
the client.
However, that is a lot of work to get right. Either the client has
to provide a localization context (so the server can generated messages
in the right language), or the client is given a method to localize
messages (e.g. by not relying on generating the message by the server,
but by generating an error code that can be looked up). It's
complicated, but just translating strings server side doesn't help.
Probably we should build libnm-core.a twice, once with l10n for libnm's
use case, and once without for the server.
The problem that the server doesn't know the l10n context is especially
bad for the name of the generated default-wired-connection, which is
something like "Wired Connection 1". See also related bug bgo#666516.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/main.c b/src/main.c index bd8e26a556..2ca28e47fc 100644 --- a/src/main.c +++ b/src/main.c @@ -178,7 +178,7 @@ print_config (NMConfigCmdLineOptions *config_cli) config = nm_config_new (config_cli, CONFIG_ATOMIC_SECTION_PREFIXES, &error); if (config == NULL) { - fprintf (stderr, _("Failed to read configuration: %s\n"), error->message); + fprintf (stderr, "Failed to read configuration: %s\n", error->message); return 7; } @@ -192,16 +192,16 @@ static void do_early_setup (int *argc, char **argv[], NMConfigCmdLineOptions *config_cli) { GOptionEntry options[] = { - { "version", 'V', 0, G_OPTION_ARG_NONE, &global_opt.show_version, N_("Print NetworkManager version and exit"), NULL }, - { "no-daemon", 'n', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &global_opt.become_daemon, N_("Don't become a daemon"), NULL }, - { "log-level", 0, 0, G_OPTION_ARG_STRING, &global_opt.opt_log_level, N_("Log level: one of [%s]"), "INFO" }, + { "version", 'V', 0, G_OPTION_ARG_NONE, &global_opt.show_version, "Print NetworkManager version and exit", NULL }, + { "no-daemon", 'n', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &global_opt.become_daemon, "Don't become a daemon", NULL }, + { "log-level", 0, 0, G_OPTION_ARG_STRING, &global_opt.opt_log_level, "Log level: one of [%s]", "INFO" }, { "log-domains", 0, 0, G_OPTION_ARG_STRING, &global_opt.opt_log_domains, - N_("Log domains separated by ',': any combination of [%s]"), + "Log domains separated by ',': any combination of [%s]", "PLATFORM,RFKILL,WIFI" }, - { "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &global_opt.g_fatal_warnings, N_("Make all warnings fatal"), NULL }, - { "pid-file", 'p', 0, G_OPTION_ARG_FILENAME, &global_opt.pidfile, N_("Specify the location of a PID file"), NM_DEFAULT_PID_FILE }, + { "g-fatal-warnings", 0, 0, G_OPTION_ARG_NONE, &global_opt.g_fatal_warnings, "Make all warnings fatal", NULL }, + { "pid-file", 'p', 0, G_OPTION_ARG_FILENAME, &global_opt.pidfile, "Specify the location of a PID file", NM_DEFAULT_PID_FILE }, { "run-from-build-dir", 0, 0, G_OPTION_ARG_NONE, &global_opt.run_from_build_dir, "Run from build directory", NULL }, - { "print-config", 0, 0, G_OPTION_ARG_NONE, &global_opt.print_config, N_("Print NetworkManager configuration and exit"), NULL }, + { "print-config", 0, 0, G_OPTION_ARG_NONE, &global_opt.print_config, "Print NetworkManager configuration and exit", NULL }, {NULL} }; @@ -211,7 +211,7 @@ do_early_setup (int *argc, char **argv[], NMConfigCmdLineOptions *config_cli) options, (void (*)(gpointer, GOptionContext *)) nm_config_cmd_line_options_add_to_entries, config_cli, - _("NetworkManager monitors all network connections and automatically\nchooses the best connection to use. It also allows the user to\nspecify wireless access points which wireless cards in the computer\nshould associate with."))) + "NetworkManager monitors all network connections and automatically\nchooses the best connection to use. It also allows the user to\nspecify wireless access points which wireless cards in the computer\nshould associate with.")) exit (1); global_opt.pidfile = global_opt.pidfile ? global_opt.pidfile : g_strdup (NM_DEFAULT_PID_FILE); @@ -301,12 +301,12 @@ main (int argc, char *argv[]) &bad_domains, &error)) { fprintf (stderr, - _("%s. Please use --help to see a list of valid options.\n"), + "%s. Please use --help to see a list of valid options.\n", error->message); exit (1); } else if (bad_domains) { fprintf (stderr, - _("Ignoring unrecognized log domain(s) '%s' passed on command line.\n"), + "Ignoring unrecognized log domain(s) '%s' passed on command line.\n", bad_domains); g_clear_pointer (&bad_domains, g_free); } @@ -316,7 +316,7 @@ main (int argc, char *argv[]) nm_config_cmd_line_options_free (config_cli); config_cli = NULL; if (config == NULL) { - fprintf (stderr, _("Failed to read configuration: %s\n"), + fprintf (stderr, "Failed to read configuration: %s\n", error->message); exit (1); } @@ -331,12 +331,12 @@ main (int argc, char *argv[]) nm_config_get_log_domains (config), &bad_domains, &error)) { - fprintf (stderr, _("Error in configuration file: %s.\n"), + fprintf (stderr, "Error in configuration file: %s.\n", error->message); exit (1); } else if (bad_domains) { fprintf (stderr, - _("Ignoring unrecognized log domain(s) '%s' from config files.\n"), + "Ignoring unrecognized log domain(s) '%s' from config files.\n", bad_domains); g_clear_pointer (&bad_domains, g_free); } @@ -347,7 +347,7 @@ main (int argc, char *argv[]) int saved_errno; saved_errno = errno; - fprintf (stderr, _("Could not daemonize: %s [error %u]\n"), + fprintf (stderr, "Could not daemonize: %s [error %u]\n", g_strerror (saved_errno), saved_errno); exit (1); |