Commit 83a6f362 authored by Thomas Haller's avatar Thomas Haller

cli: don't mark field names for translation

Before refactoring nmcli recently, field names were marked for translation.
Note that for the property names, marking them had no effect as only
plain strings can be marked with N_().

Note how --fields are also an input argument. The input should be
independent of the locale and not translated. Likewise, when printing
the header names, they should not be translated to match the --fields
option.

    $ LANG=de_DE.utf8 nmcli --fields GENERAL.DEVICE device show enp0s25
    GENERAL.GERÄT:                          enp0s25

Drop the translation marks.
parent 7aab314c
......@@ -732,10 +732,10 @@ nmc_setting_get_property_desc (NMSetting *setting, const char *prop)
if (property_info->property_type->describe_fcn) {
desc = property_info->property_type->describe_fcn (property_info, &desc_to_free);
} else
desc = property_info->describe_message;
desc = _(property_info->describe_message);
if (desc) {
nmcli_desc = _(desc);
nmcli_desc = desc;
nmcli_desc_title = _("[nmcli specific description]");
nmcli_nl = "\n";
}
......
......@@ -98,13 +98,8 @@ _meta_type_nmc_generic_info_get_fcn (const NMMetaAbstractInfo *abstract_info,
}
if (info->nested) {
const char *s;
NMC_HANDLE_TERMFORMAT (NM_META_TERM_COLOR_NORMAL);
s = info->name;
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
return _(s);
return s;
return info->name;
}
g_return_val_if_reached (NULL);
......@@ -1083,7 +1078,6 @@ _print_fill (const NmcConfig *nmc_config,
PrintDataHeaderCell *header_cell;
guint col_idx;
const NMMetaAbstractInfo *info;
gboolean translate_title;
col = &cols[i_col];
if (!col->is_leaf)
......@@ -1099,8 +1093,6 @@ _print_fill (const NmcConfig *nmc_config,
header_cell->col_idx = col_idx;
header_cell->col = col;
translate_title = pretty;
header_cell->title = nm_meta_abstract_info_get_name (info, TRUE);
if ( nmc_config->multiline_output
&& col->parent_idx != PRINT_DATA_COL_PARENT_NIL
......@@ -1111,9 +1103,6 @@ _print_fill (const NmcConfig *nmc_config,
nm_meta_abstract_info_get_name (cols[col->parent_idx].selection_item->info, FALSE),
header_cell->title);
header_cell->title_to_free = TRUE;
} else {
if (translate_title)
header_cell->title = _(header_cell->title);
}
}
......@@ -1476,7 +1465,7 @@ get_value_to_print (NmcColorOption color_option,
nm_assert (out_to_free && !*out_to_free);
if (field_name)
value = _(nm_meta_abstract_info_get_name (field->info, FALSE));
value = nm_meta_abstract_info_get_name (field->info, FALSE);
else {
value = field->value
? (is_array
......@@ -1584,7 +1573,7 @@ print_required_fields (const NmcConfig *nmc_config,
tmp = g_strdup_printf ("%s%s%s[%d]:",
section_prefix ? (const char*) field_values[0].value : "",
section_prefix ? "." : "",
_(nm_meta_abstract_info_get_name (field_values[idx].info, FALSE)),
nm_meta_abstract_info_get_name (field_values[idx].info, FALSE),
j);
width1 = strlen (tmp);
width2 = nmc_string_screen_width (tmp, NULL);
......@@ -1605,7 +1594,7 @@ print_required_fields (const NmcConfig *nmc_config,
tmp = g_strdup_printf ("%s%s%s:",
section_prefix ? hdr_name : "",
section_prefix ? "." : "",
_(nm_meta_abstract_info_get_name (field_values[idx].info, FALSE)));
nm_meta_abstract_info_get_name (field_values[idx].info, FALSE));
width1 = strlen (tmp);
width2 = nmc_string_screen_width (tmp, NULL);
g_print ("%-*s%s\n", (int) (terse ? 0 : ML_VALUE_INDENT+width1-width2), tmp, print_val);
......
......@@ -145,7 +145,7 @@ struct _NmcMetaGenericInfo {
#define NMC_META_GENERIC(n, ...) \
(&((NmcMetaGenericInfo) { \
.meta_type = &nmc_meta_type_generic_info, \
.name = N_(n), \
.name = n, \
__VA_ARGS__ \
}))
......
......@@ -4937,7 +4937,7 @@ static const NMMetaPropertyType _pt_gobject_devices = {
{ \
.meta_type = &nm_meta_type_property_info, \
.setting_info = &nm_meta_setting_infos_editor[_CURRENT_NM_META_SETTING_TYPE], \
.property_name = N_(name), \
.property_name = name, \
.describe_doc = doc, \
__VA_ARGS__ \
}
......@@ -7444,8 +7444,6 @@ _meta_type_setting_info_editor_get_fcn (const NMMetaAbstractInfo *abstract_info,
nm_assert (out_to_free);
if (get_type == NM_META_ACCESSOR_GET_TYPE_PRETTY)
return _(info->general->setting_name);
return info->general->setting_name;
}
......
......@@ -186,8 +186,10 @@ struct _NMMetaOperationContext {
struct _NMMetaPropertyType {
/* should return a translated string */
const char *(*describe_fcn) (const NMMetaPropertyInfo *property_info,
char **out_to_free);
gconstpointer (*get_fcn) (const NMMetaPropertyInfo *property_info,
const NMMetaEnvironment *environment,
gpointer environment_user_data,
......@@ -281,6 +283,7 @@ struct _NMMetaPropertyInfo {
const char *describe_doc;
/* a non-translated but translatable static description (marked with N_()). */
const char *describe_message;
const NMMetaPropertyType *property_type;
......
......@@ -142,178 +142,177 @@ const NMSetting8021xSchemeVtable nm_setting_8021x_scheme_vtable[] = {
const NMMetaSettingInfo nm_meta_setting_infos[] = {
[NM_META_SETTING_TYPE_802_1X] = {
.meta_type = NM_META_SETTING_TYPE_802_1X,
.setting_name = N_(NM_SETTING_802_1X_SETTING_NAME),
.setting_name = NM_SETTING_802_1X_SETTING_NAME,
.get_setting_gtype = nm_setting_802_1x_get_type,
},
[NM_META_SETTING_TYPE_ADSL] = {
.meta_type = NM_META_SETTING_TYPE_ADSL,
.setting_name = N_(NM_SETTING_ADSL_SETTING_NAME),
.setting_name = NM_SETTING_ADSL_SETTING_NAME,
.get_setting_gtype = nm_setting_adsl_get_type,
},
[NM_META_SETTING_TYPE_BLUETOOTH] = {
.meta_type = NM_META_SETTING_TYPE_BLUETOOTH,
.setting_name = N_(NM_SETTING_BLUETOOTH_SETTING_NAME),
.setting_name = NM_SETTING_BLUETOOTH_SETTING_NAME,
.get_setting_gtype = nm_setting_bluetooth_get_type,
},
[NM_META_SETTING_TYPE_BOND] = {
.meta_type = NM_META_SETTING_TYPE_BOND,
.setting_name = N_(NM_SETTING_BOND_SETTING_NAME),
.setting_name = NM_SETTING_BOND_SETTING_NAME,
.get_setting_gtype = nm_setting_bond_get_type,
},
[NM_META_SETTING_TYPE_BRIDGE] = {
.meta_type = NM_META_SETTING_TYPE_BRIDGE,
.setting_name = N_(NM_SETTING_BRIDGE_SETTING_NAME),
.setting_name = NM_SETTING_BRIDGE_SETTING_NAME,
.get_setting_gtype = nm_setting_bridge_get_type,
},
[NM_META_SETTING_TYPE_BRIDGE_PORT] = {
.meta_type = NM_META_SETTING_TYPE_BRIDGE_PORT,
.setting_name = N_(NM_SETTING_BRIDGE_PORT_SETTING_NAME),
.setting_name = NM_SETTING_BRIDGE_PORT_SETTING_NAME,
.get_setting_gtype = nm_setting_bridge_port_get_type,
},
[NM_META_SETTING_TYPE_CDMA] = {
.meta_type = NM_META_SETTING_TYPE_CDMA,
.setting_name = N_(NM_SETTING_CDMA_SETTING_NAME),
.setting_name = NM_SETTING_CDMA_SETTING_NAME,
.get_setting_gtype = nm_setting_cdma_get_type,
},
[NM_META_SETTING_TYPE_CONNECTION] = {
.meta_type = NM_META_SETTING_TYPE_CONNECTION,
.setting_name = N_(NM_SETTING_CONNECTION_SETTING_NAME),
.setting_name = NM_SETTING_CONNECTION_SETTING_NAME,
.get_setting_gtype = nm_setting_connection_get_type,
},
[NM_META_SETTING_TYPE_DCB] = {
.meta_type = NM_META_SETTING_TYPE_DCB,
.setting_name = N_(NM_SETTING_DCB_SETTING_NAME),
.setting_name = NM_SETTING_DCB_SETTING_NAME,
.get_setting_gtype = nm_setting_dcb_get_type,
},
[NM_META_SETTING_TYPE_DUMMY] = {
.meta_type = NM_META_SETTING_TYPE_DUMMY,
.setting_name = N_(NM_SETTING_DUMMY_SETTING_NAME),
.setting_name = NM_SETTING_DUMMY_SETTING_NAME,
.get_setting_gtype = nm_setting_dummy_get_type,
},
[NM_META_SETTING_TYPE_GENERIC] = {
.meta_type = NM_META_SETTING_TYPE_GENERIC,
.setting_name = N_(NM_SETTING_GENERIC_SETTING_NAME),
.setting_name = NM_SETTING_GENERIC_SETTING_NAME,
.get_setting_gtype = nm_setting_generic_get_type,
},
[NM_META_SETTING_TYPE_GSM] = {
.meta_type = NM_META_SETTING_TYPE_GSM,
.setting_name = N_(NM_SETTING_GSM_SETTING_NAME),
.setting_name = NM_SETTING_GSM_SETTING_NAME,
.get_setting_gtype = nm_setting_gsm_get_type,
},
[NM_META_SETTING_TYPE_INFINIBAND] = {
.meta_type = NM_META_SETTING_TYPE_INFINIBAND,
.setting_name = N_(NM_SETTING_INFINIBAND_SETTING_NAME),
.setting_name = NM_SETTING_INFINIBAND_SETTING_NAME,
.get_setting_gtype = nm_setting_infiniband_get_type,
},
[NM_META_SETTING_TYPE_IP4_CONFIG] = {
.meta_type = NM_META_SETTING_TYPE_IP4_CONFIG,
.setting_name = N_(NM_SETTING_IP4_CONFIG_SETTING_NAME),
.setting_name = NM_SETTING_IP4_CONFIG_SETTING_NAME,
.get_setting_gtype = nm_setting_ip4_config_get_type,
},
[NM_META_SETTING_TYPE_IP6_CONFIG] = {
.meta_type = NM_META_SETTING_TYPE_IP6_CONFIG,
.setting_name = N_(NM_SETTING_IP6_CONFIG_SETTING_NAME),
.setting_name = NM_SETTING_IP6_CONFIG_SETTING_NAME,
.get_setting_gtype = nm_setting_ip6_config_get_type,
},
[NM_META_SETTING_TYPE_IP_TUNNEL] = {
.meta_type = NM_META_SETTING_TYPE_IP_TUNNEL,
.setting_name = N_(NM_SETTING_IP_TUNNEL_SETTING_NAME),
.setting_name = NM_SETTING_IP_TUNNEL_SETTING_NAME,
.get_setting_gtype = nm_setting_ip_tunnel_get_type,
},
[NM_META_SETTING_TYPE_MACSEC] = {
.meta_type = NM_META_SETTING_TYPE_MACSEC,
.setting_name = N_(NM_SETTING_MACSEC_SETTING_NAME),
.setting_name = NM_SETTING_MACSEC_SETTING_NAME,
.get_setting_gtype = nm_setting_macsec_get_type,
},
[NM_META_SETTING_TYPE_MACVLAN] = {
.meta_type = NM_META_SETTING_TYPE_MACVLAN,
.setting_name = N_(NM_SETTING_MACVLAN_SETTING_NAME),
.setting_name = NM_SETTING_MACVLAN_SETTING_NAME,
.get_setting_gtype = nm_setting_macvlan_get_type,
},
[NM_META_SETTING_TYPE_OLPC_MESH] = {
.meta_type = NM_META_SETTING_TYPE_OLPC_MESH,
.setting_name = N_(NM_SETTING_OLPC_MESH_SETTING_NAME),
.setting_name = NM_SETTING_OLPC_MESH_SETTING_NAME,
.get_setting_gtype = nm_setting_olpc_mesh_get_type,
},
[NM_META_SETTING_TYPE_PPPOE] = {
.meta_type = NM_META_SETTING_TYPE_PPPOE,
.setting_name = N_(NM_SETTING_PPPOE_SETTING_NAME),
.setting_name = NM_SETTING_PPPOE_SETTING_NAME,
.get_setting_gtype = nm_setting_pppoe_get_type,
},
[NM_META_SETTING_TYPE_PPP] = {
.meta_type = NM_META_SETTING_TYPE_PPP,
.setting_name = N_(NM_SETTING_PPP_SETTING_NAME),
.setting_name = NM_SETTING_PPP_SETTING_NAME,
.get_setting_gtype = nm_setting_ppp_get_type,
},
[NM_META_SETTING_TYPE_PROXY] = {
.meta_type = NM_META_SETTING_TYPE_PROXY,
.setting_name = N_(NM_SETTING_PROXY_SETTING_NAME),
.setting_name = NM_SETTING_PROXY_SETTING_NAME,
.get_setting_gtype = nm_setting_proxy_get_type,
},
[NM_META_SETTING_TYPE_SERIAL] = {
.meta_type = NM_META_SETTING_TYPE_SERIAL,
.setting_name = N_(NM_SETTING_SERIAL_SETTING_NAME),
.setting_name = NM_SETTING_SERIAL_SETTING_NAME,
.get_setting_gtype = nm_setting_serial_get_type,
},
[NM_META_SETTING_TYPE_TEAM] = {
.meta_type = NM_META_SETTING_TYPE_TEAM,
.setting_name = N_(NM_SETTING_TEAM_SETTING_NAME),
.setting_name = NM_SETTING_TEAM_SETTING_NAME,
.get_setting_gtype = nm_setting_team_get_type,
},
[NM_META_SETTING_TYPE_TEAM_PORT] = {
.meta_type = NM_META_SETTING_TYPE_TEAM_PORT,
.setting_name = N_(NM_SETTING_TEAM_PORT_SETTING_NAME),
.setting_name = NM_SETTING_TEAM_PORT_SETTING_NAME,
.get_setting_gtype = nm_setting_team_port_get_type,
},
[NM_META_SETTING_TYPE_TUN] = {
.meta_type = NM_META_SETTING_TYPE_TUN,
.setting_name = N_(NM_SETTING_TUN_SETTING_NAME),
.setting_name = NM_SETTING_TUN_SETTING_NAME,
.get_setting_gtype = nm_setting_tun_get_type,
},
[NM_META_SETTING_TYPE_USER] = {
.meta_type = NM_META_SETTING_TYPE_USER,
.setting_name = N_(NM_SETTING_USER_SETTING_NAME),
.setting_name = NM_SETTING_USER_SETTING_NAME,
.get_setting_gtype = nm_setting_user_get_type,
},
[NM_META_SETTING_TYPE_VLAN] = {
.meta_type = NM_META_SETTING_TYPE_VLAN,
.setting_name = N_(NM_SETTING_VLAN_SETTING_NAME),
.setting_name = NM_SETTING_VLAN_SETTING_NAME,
.get_setting_gtype = nm_setting_vlan_get_type,
},
[NM_META_SETTING_TYPE_VPN] = {
.meta_type = NM_META_SETTING_TYPE_VPN,
.setting_name = N_(NM_SETTING_VPN_SETTING_NAME),
.setting_name = NM_SETTING_VPN_SETTING_NAME,
.get_setting_gtype = nm_setting_vpn_get_type,
},
[NM_META_SETTING_TYPE_VXLAN] = {
.meta_type = NM_META_SETTING_TYPE_VXLAN,
.setting_name = N_(NM_SETTING_VXLAN_SETTING_NAME),
.setting_name = NM_SETTING_VXLAN_SETTING_NAME,
.get_setting_gtype = nm_setting_vxlan_get_type,
},
[NM_META_SETTING_TYPE_WIMAX] = {
.meta_type = NM_META_SETTING_TYPE_WIMAX,
.setting_name = N_(NM_SETTING_WIMAX_SETTING_NAME),
.setting_name = NM_SETTING_WIMAX_SETTING_NAME,
.get_setting_gtype = nm_setting_wimax_get_type,
},
[NM_META_SETTING_TYPE_WIRED] = {
.meta_type = NM_META_SETTING_TYPE_WIRED,
.setting_name = N_(NM_SETTING_WIRED_SETTING_NAME),
.setting_name = NM_SETTING_WIRED_SETTING_NAME,
.get_setting_gtype = nm_setting_wired_get_type,
},
[NM_META_SETTING_TYPE_WIRELESS] = {
.meta_type = NM_META_SETTING_TYPE_WIRELESS,
.setting_name = N_(NM_SETTING_WIRELESS_SETTING_NAME),
.setting_name = NM_SETTING_WIRELESS_SETTING_NAME,
.get_setting_gtype = nm_setting_wireless_get_type,
},
[NM_META_SETTING_TYPE_WIRELESS_SECURITY] = {
.meta_type = NM_META_SETTING_TYPE_WIRELESS_SECURITY,
.setting_name = N_(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME),
.setting_name = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
.get_setting_gtype = nm_setting_wireless_security_get_type,
},
[NM_META_SETTING_TYPE_UNKNOWN] = {
.meta_type = NM_META_SETTING_TYPE_UNKNOWN,
.setting_name = NULL,
},
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment