gdbus: factor out untranslatable parts of error messages

This commit is contained in:
José Guilherme 2024-06-13 18:30:58 +00:00 committed by Philip Withnall
parent ea58dcb538
commit efe2c24757
3 changed files with 29 additions and 12 deletions

View File

@ -619,8 +619,12 @@ g_dbus_address_connect (const gchar *address_entry,
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("Error in address “%s” — the host attribute is missing or malformed"),
address_entry);
/* Translators: The first placeholder is a D-Bus connection address,
* the second is the literal name of an attribute in the address.
*/
_("Error in address “%s” — the %s attribute is missing or malformed"),
address_entry,
"host");
goto out;
}
@ -633,8 +637,9 @@ g_dbus_address_connect (const gchar *address_entry,
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("Error in address “%s” — the port attribute is missing or malformed"),
address_entry);
_("Error in address “%s” — the %s attribute is missing or malformed"),
address_entry,
"port");
goto out;
}
@ -647,8 +652,9 @@ g_dbus_address_connect (const gchar *address_entry,
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("Error in address “%s” — the noncefile attribute is missing or malformed"),
address_entry);
_("Error in address “%s” — the %s attribute is missing or malformed"),
address_entry,
"noncefile");
goto out;
}
}

View File

@ -4716,7 +4716,10 @@ invoke_get_property_in_idle_cb (gpointer _data)
{
reply = g_dbus_message_new_method_error (data->message,
DBUS_ERROR_UNKNOWN_METHOD,
_("No such interface “org.freedesktop.DBus.Properties” on object at path %s"),
/* Translators: The first placeholder is a D-Bus interface,
* the second is the path of an object. */
_("No such interface “%s” on object at path %s"),
DBUS_INTERFACE_PROPERTIES,
g_dbus_message_get_path (data->message));
g_dbus_connection_send_message (data->connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
g_object_unref (reply);
@ -5070,7 +5073,8 @@ invoke_get_all_properties_in_idle_cb (gpointer _data)
{
reply = g_dbus_message_new_method_error (data->message,
DBUS_ERROR_UNKNOWN_METHOD,
_("No such interface “org.freedesktop.DBus.Properties” on object at path %s"),
_("No such interface “%s” on object at path %s"),
DBUS_INTERFACE_PROPERTIES,
g_dbus_message_get_path (data->message));
g_dbus_connection_send_message (data->connection, reply, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
g_object_unref (reply);

View File

@ -1421,8 +1421,13 @@ validate_headers (GDBusMessage *message,
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("%s message: PATH header field is using the reserved value /org/freedesktop/DBus/Local"),
message_type_to_string (message->type));
/* Translators: The first placeholder is a D-Bus message type,
* the second is the name of a header field and the third is
* a value that is reserved for the given field. */
_("%s message: %s header field is using the reserved value %s"),
message_type_to_string (message->type),
"PATH",
DBUS_PATH_LOCAL);
goto out;
}
break;
@ -1443,8 +1448,10 @@ validate_headers (GDBusMessage *message,
g_set_error (error,
G_IO_ERROR,
G_IO_ERROR_INVALID_ARGUMENT,
_("%s message: INTERFACE header field is using the reserved value org.freedesktop.DBus.Local"),
message_type_to_string (message->type));
_("%s message: %s header field is using the reserved value %s"),
message_type_to_string (message->type),
"INTERFACE",
DBUS_INTERFACE_LOCAL);
goto out;
}
break;