2021-02-20 12:28:32 +00:00
|
|
|
use crate::database::Query;
|
|
|
|
use gettext_macros::i18n;
|
2022-02-26 15:54:07 +00:00
|
|
|
use rocket_i18n::I18n;
|
2021-02-20 12:28:32 +00:00
|
|
|
|
|
|
|
pub fn describe_query_error(i18n: &I18n, q: &Query) -> String {
|
|
|
|
match q {
|
2022-02-26 15:54:07 +00:00
|
|
|
Query::ByFingerprint(fpr) => {
|
|
|
|
i18n!(i18n.catalog, "No key found for fingerprint {}"; fpr)
|
|
|
|
}
|
|
|
|
Query::ByKeyID(key_id) => {
|
|
|
|
i18n!(i18n.catalog, "No key found for key id {}"; key_id)
|
|
|
|
}
|
|
|
|
Query::ByEmail(email) => {
|
|
|
|
i18n!(i18n.catalog, "No key found for email address {}"; email)
|
|
|
|
}
|
|
|
|
Query::InvalidShort() => {
|
|
|
|
i18n!(i18n.catalog, "Search by Short Key ID is not supported.")
|
|
|
|
}
|
2021-02-20 12:28:32 +00:00
|
|
|
Query::Invalid() => i18n!(i18n.catalog, "Invalid search query."),
|
|
|
|
}
|
|
|
|
}
|