i18n on the web - deepseek translations2

This commit is contained in:
Priec
2026-08-14 20:52:31 +02:00
parent 8f1bfdbe0c
commit 967335d4ca
16 changed files with 110 additions and 33 deletions

View File

@@ -1718,7 +1718,7 @@ pub(crate) mod tests {
draft.type_input = "temporal".to_string();
// Incomplete while no subtype is chosen.
assert_eq!(draft.canonical_type_input().unwrap(), None);
assert_eq!(draft.canonical_type_input(crate::i18n::Locale::default()).unwrap(), None);
assert!(draft.show_temporal_type());
draft.temporal_type_input = "raw_datetime".to_string();
@@ -1735,7 +1735,7 @@ pub(crate) mod tests {
draft.name_input = "weight".to_string();
draft.type_input = "decimal".to_string();
assert_eq!(draft.canonical_type_input().unwrap(), None);
assert_eq!(draft.canonical_type_input(crate::i18n::Locale::default()).unwrap(), None);
assert!(draft.show_decimal_arguments());
draft.decimal_precision_input = "12".to_string();
draft.decimal_scale_input = "3".to_string();
@@ -1750,7 +1750,7 @@ pub(crate) mod tests {
draft.type_input = "link".to_string();
assert!(draft.show_link_target());
assert_eq!(draft.canonical_type_input().unwrap(), None);
assert_eq!(draft.canonical_type_input(crate::i18n::Locale::default()).unwrap(), None);
draft.link_table_input = "customer".to_string();
draft.add_from_inputs(crate::i18n::Locale::default()).unwrap();
@@ -1763,7 +1763,7 @@ pub(crate) mod tests {
#[test]
fn bare_link_type_is_rejected_without_a_target() {
assert_eq!(
draft().catalog.validate_field_type("link"),
draft().catalog.validate_field_type(crate::i18n::Locale::default(), "link"),
Some("`link` needs a referenced table.".to_string())
);
}
@@ -1858,7 +1858,7 @@ pub(crate) mod tests {
assert!(draft.add_from_inputs(crate::i18n::Locale::default()).is_err());
assert!(
catalog()
.validate_field_type("phone_calling_code")
.validate_field_type(crate::i18n::Locale::default(), "phone_calling_code")
.is_some()
);
}
@@ -2344,13 +2344,13 @@ pub(crate) mod tests {
assert_eq!(MAX_TABLE_NAME_LENGTH, 38);
let longest = "t".repeat(MAX_TABLE_NAME_LENGTH);
assert_eq!(validate_table_name(&longest), None);
assert_eq!(validate_identifier(&longest, "Column name", true), None);
assert_eq!(validate_table_name(crate::i18n::Locale::default(), &longest), None);
assert_eq!(validate_identifier(crate::i18n::Locale::default(), &longest, "Column name", true), None);
let too_long = "t".repeat(MAX_TABLE_NAME_LENGTH + 1);
assert!(validate_table_name(&too_long).is_some());
assert!(validate_table_name(crate::i18n::Locale::default(), &too_long).is_some());
// Still a perfectly good column name, which is why the two differ.
assert_eq!(validate_identifier(&too_long, "Column name", true), None);
assert_eq!(validate_identifier(crate::i18n::Locale::default(), &too_long, "Column name", true), None);
}
/// Every profile is given these tables when it is created, so a new table
@@ -2358,11 +2358,11 @@ pub(crate) mod tests {
#[test]
fn the_tables_every_profile_is_given_keep_their_names() {
for name in RESERVED_TABLE_NAMES {
let error = validate_table_name(name)
let error = validate_table_name(crate::i18n::Locale::default(), name)
.unwrap_or_else(|| panic!("`{name}` should be reserved"));
assert!(error.contains(name), "{error}");
}
assert_eq!(validate_table_name("invoice"), None);
assert_eq!(validate_table_name(crate::i18n::Locale::default(), "invoice"), None);
}
}
@@ -2374,7 +2374,7 @@ mod link_alias_tests {
/// derived from a table name any more.
#[test]
fn a_column_name_may_end_in_id() {
assert_eq!(validate_identifier("external_id", "Column name", true), None);
assert_eq!(validate_identifier(crate::i18n::Locale::default(), "external_id", "Column name", true), None);
}
/// The system columns stay reserved, since they share one namespace with
@@ -2383,7 +2383,7 @@ mod link_alias_tests {
fn the_system_columns_stay_reserved() {
for name in ["id", "deleted", "created_at", "row_revision"] {
assert!(
validate_identifier(name, "Column name", true).is_some(),
validate_identifier(crate::i18n::Locale::default(), name, "Column name", true).is_some(),
"`{name}` must stay reserved"
);
}