Skip to content

Commit 02a7d5b

Browse files
committed
Localize string messages
1 parent c7bb77b commit 02a7d5b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

dsc_lib/locales/en-us.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ invalidArrayArg = "First argument must be an array"
331331
description = "Joins the elements of an array into a single string, separated using a delimiter."
332332
invoked = "join function"
333333
invalidArrayArg = "First argument must be an array"
334+
invalidNullElement = "Array elements cannot be null"
335+
invalidArrayElement = "Array elements cannot be arrays"
336+
invalidObjectElement = "Array elements cannot be objects"
334337

335338
[functions.lastIndexOf]
336339
description = "Returns the index of the last occurrence of an item in an array"

dsc_lib/src/functions/join.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ fn stringify_value(v: &Value) -> Result<String, DscError> {
1616
Value::String(s) => Ok(s.clone()),
1717
Value::Number(n) => Ok(n.to_string()),
1818
Value::Bool(b) => Ok(b.to_string()),
19-
Value::Null => Err(DscError::Parser("Array elements cannot be null".to_string())),
20-
Value::Array(_) => Err(DscError::Parser("Array elements cannot be arrays".to_string())),
21-
Value::Object(_) => Err(DscError::Parser("Array elements cannot be objects".to_string())),
19+
Value::Null => Err(DscError::Parser(t!("functions.join.invalidNullElement").to_string())),
20+
Value::Array(_) => Err(DscError::Parser(t!("functions.join.invalidArrayElement").to_string())),
21+
Value::Object(_) => Err(DscError::Parser(t!("functions.join.invalidObjectElement").to_string())),
2222
}
2323
}
2424

0 commit comments

Comments
 (0)