diff options
author | Thomas Haller <thaller@redhat.com> | 2018-12-01 15:32:55 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-12-11 09:23:47 +0100 |
commit | 0c17d34a7df5a87ae65913580fa118538e02e01a (patch) | |
tree | 6c320389e7d75d2173c9f52674598e88631e1be9 | |
parent | 3b515f54cfa23d6b4b8425b700f7e26b8341b528 (diff) | |
download | NetworkManager-0c17d34a7df5a87ae65913580fa118538e02e01a.tar.gz |
cli: drop gettext() wrappers for no_l10n to-string functions
In most cases, we don't want the translated string (only marked
for translation, and then programatically the caller deciedes
whether to translate or not).
The few places that always call gettext() can do it explicitly.
Now, that our functions are all "no_l10n" by default, rename them.
-rw-r--r-- | clients/cli/common.c | 8 | ||||
-rw-r--r-- | clients/cli/common.h | 1 | ||||
-rw-r--r-- | clients/cli/devices.c | 8 | ||||
-rw-r--r-- | clients/cli/general.c | 21 |
4 files changed, 13 insertions, 25 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c index 945cd5b474..85b5005e44 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -1394,7 +1394,7 @@ nmc_error_get_simple_message (GError *error) /*****************************************************************************/ -NM_UTILS_LOOKUP_STR_DEFINE (nm_connectivity_to_string_no_l10n, NMConnectivityState, +NM_UTILS_LOOKUP_STR_DEFINE (nm_connectivity_to_string, NMConnectivityState, NM_UTILS_LOOKUP_DEFAULT (N_("unknown")), NM_UTILS_LOOKUP_ITEM (NM_CONNECTIVITY_NONE, N_("none")), NM_UTILS_LOOKUP_ITEM (NM_CONNECTIVITY_PORTAL, N_("portal")), @@ -1402,9 +1402,3 @@ NM_UTILS_LOOKUP_STR_DEFINE (nm_connectivity_to_string_no_l10n, NMConnectivitySta NM_UTILS_LOOKUP_ITEM (NM_CONNECTIVITY_FULL, N_("full")), NM_UTILS_LOOKUP_ITEM_IGNORE (NM_CONNECTIVITY_UNKNOWN), ); - -const char * -nm_connectivity_to_string (NMConnectivityState connectivity) -{ - return _(nm_connectivity_to_string_no_l10n (connectivity)); -} diff --git a/clients/cli/common.h b/clients/cli/common.h index 5d075249e9..71734acc98 100644 --- a/clients/cli/common.h +++ b/clients/cli/common.h @@ -99,6 +99,5 @@ extern const NmcMetaGenericInfo *const metagen_ip6_config[]; extern const NmcMetaGenericInfo *const metagen_dhcp_config[]; const char *nm_connectivity_to_string (NMConnectivityState connectivity); -const char *nm_connectivity_to_string_no_l10n (NMConnectivityState connectivity); #endif /* NMC_COMMON_H */ diff --git a/clients/cli/devices.c b/clients/cli/devices.c index ee2495e00b..f1a97d3ea8 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -117,10 +117,10 @@ _metagen_device_status_get_fcn (NMC_META_GENERIC_INFO_GET_FCN_ARGS) return nmc_meta_generic_get_str_i18n (nmc_device_state_to_string (nm_device_get_state (d)), get_type); case NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_IP4_CONNECTIVITY: - return nmc_meta_generic_get_str_i18n (nm_connectivity_to_string_no_l10n (nm_device_get_connectivity (d, AF_INET)), + return nmc_meta_generic_get_str_i18n (nm_connectivity_to_string (nm_device_get_connectivity (d, AF_INET)), get_type); case NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_IP6_CONNECTIVITY: - return nmc_meta_generic_get_str_i18n (nm_connectivity_to_string_no_l10n (nm_device_get_connectivity (d, AF_INET6)), + return nmc_meta_generic_get_str_i18n (nm_connectivity_to_string (nm_device_get_connectivity (d, AF_INET6)), get_type); case NMC_GENERIC_INFO_TYPE_DEVICE_STATUS_DBUS_PATH: return nm_object_get_path (NM_OBJECT (d)); @@ -207,13 +207,13 @@ _metagen_device_detail_general_get_fcn (NMC_META_GENERIC_INFO_GET_FCN_ARGS) connectivity = nm_device_get_connectivity (d, AF_INET); return (*out_to_free = nmc_meta_generic_get_enum_with_detail (NMC_META_GENERIC_GET_ENUM_TYPE_PARENTHESES, connectivity, - nm_connectivity_to_string_no_l10n (connectivity), + nm_connectivity_to_string (connectivity), get_type)); case NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_IP6_CONNECTIVITY: connectivity = nm_device_get_connectivity (d, AF_INET6); return (*out_to_free = nmc_meta_generic_get_enum_with_detail (NMC_META_GENERIC_GET_ENUM_TYPE_PARENTHESES, connectivity, - nm_connectivity_to_string_no_l10n (connectivity), + nm_connectivity_to_string (connectivity), get_type)); case NMC_GENERIC_INFO_TYPE_DEVICE_DETAIL_GENERAL_UDI: return nm_device_get_udi (d); diff --git a/clients/cli/general.c b/clients/cli/general.c index b2f72c6a4e..d9128c7670 100644 --- a/clients/cli/general.c +++ b/clients/cli/general.c @@ -37,7 +37,7 @@ /*****************************************************************************/ -NM_UTILS_LOOKUP_STR_DEFINE_STATIC (nm_state_to_string_no_l10n, NMState, +NM_UTILS_LOOKUP_STR_DEFINE_STATIC (nm_state_to_string, NMState, NM_UTILS_LOOKUP_DEFAULT (N_("unknown")), NM_UTILS_LOOKUP_ITEM (NM_STATE_ASLEEP, N_("asleep")), NM_UTILS_LOOKUP_ITEM (NM_STATE_CONNECTING, N_("connecting")), @@ -49,12 +49,6 @@ NM_UTILS_LOOKUP_STR_DEFINE_STATIC (nm_state_to_string_no_l10n, NMState, NM_UTILS_LOOKUP_ITEM_IGNORE (NM_STATE_UNKNOWN), ); -static const char * -nm_state_to_string (NMState state) -{ - return _(nm_state_to_string_no_l10n (state)); -} - static NMMetaColor state_to_color (NMState state) { @@ -136,7 +130,7 @@ permission_to_string (NMClientPermission perm) } } -NM_UTILS_LOOKUP_STR_DEFINE_STATIC (permission_result_to_string_no_l10n, NMClientPermissionResult, +NM_UTILS_LOOKUP_STR_DEFINE_STATIC (permission_result_to_string, NMClientPermissionResult, NM_UTILS_LOOKUP_DEFAULT (N_("unknown")), NM_UTILS_LOOKUP_ITEM (NM_CLIENT_PERMISSION_RESULT_YES, N_("yes")), NM_UTILS_LOOKUP_ITEM (NM_CLIENT_PERMISSION_RESULT_NO, N_("no")), @@ -177,7 +171,7 @@ _metagen_general_status_get_fcn (NMC_META_GENERIC_INFO_GET_FCN_ARGS) case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_STATE: state = nm_client_get_state (nmc->client); NMC_HANDLE_COLOR (state_to_color (state)); - value = nm_state_to_string_no_l10n (state); + value = nm_state_to_string (state); goto translate_and_out; case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_STARTUP: v_bool = nm_client_get_startup (nmc->client); @@ -187,7 +181,7 @@ _metagen_general_status_get_fcn (NMC_META_GENERIC_INFO_GET_FCN_ARGS) case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_CONNECTIVITY: connectivity = nm_client_get_connectivity (nmc->client); NMC_HANDLE_COLOR (connectivity_to_color (connectivity)); - value = nm_connectivity_to_string_no_l10n (connectivity); + value = nm_connectivity_to_string (connectivity); goto translate_and_out; case NMC_GENERIC_INFO_TYPE_GENERAL_STATUS_NETWORKING: v_bool = nm_client_networking_get_enabled (nmc->client); @@ -271,7 +265,7 @@ _metagen_general_permissions_get_fcn (NMC_META_GENERIC_INFO_GET_FCN_ARGS) case NMC_GENERIC_INFO_TYPE_GENERAL_PERMISSIONS_VALUE: perm_result = nm_client_get_permission_result (nmc->client, perm); NMC_HANDLE_COLOR (permission_result_to_color (perm_result)); - s = permission_result_to_string_no_l10n (perm_result); + s = permission_result_to_string (perm_result); if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY) return _(s); return s; @@ -1098,7 +1092,8 @@ client_connectivity (NMClient *client, GParamSpec *param, NmCli *nmc) g_object_get (client, NM_CLIENT_CONNECTIVITY, &connectivity, NULL); str = nmc_colorize (&nmc->nmc_config, connectivity_to_color (connectivity), - _("Connectivity is now '%s'\n"), nm_connectivity_to_string (connectivity)); + _("Connectivity is now '%s'\n"), + gettext (nm_connectivity_to_string (connectivity))); g_print ("%s", str); g_free (str); } @@ -1112,7 +1107,7 @@ client_state (NMClient *client, GParamSpec *param, NmCli *nmc) g_object_get (client, NM_CLIENT_STATE, &state, NULL); str = nmc_colorize (&nmc->nmc_config, state_to_color (state), _("Networkmanager is now in the '%s' state\n"), - nm_state_to_string (state)); + gettext (nm_state_to_string (state))); g_print ("%s", str); g_free (str); } |