i18n: Hebrew on one line, its sign held left, CLDR's short years
gpui 0.2.2 wraps shaped glyphs in the order they are drawn, so a right-to-left line that wraps comes out garbled. The demo's Hebrew lines are Ellipses, which cut by characters, and an Ellipsis now sits by its text's alignment, so a short line under text_right lies at the right; the editor's completion details take the side they ask for. A right-to-left locale leads a minus with a left-to-right mark, as CLDR does, so the sign stays at the digits' left inside Hebrew. en-US and de-DE write CLDR's two-digit year. The repeated-key and second-catalog guards have tests.
This commit is contained in:
1 parent
ae5f2334f5
commit
83ecacde65
6 files changed
+68
-18
No files matched your search
+8
-4
@@ -61,7 +61,7 @@ pub const LOCALES: [Locale; 7] = [
|
||||
"en-US",
|
||||
"English (US)",
|
||||
(',', '.'),
|
||||
"%-m/%-d/%Y",
|
||||
"%-m/%-d/%y",
|
||||
Direction::Ltr,
|
||||
),
|
||||
locale(
|
||||
@@ -71,7 +71,7 @@ pub const LOCALES: [Locale; 7] = [
|
||||
"%d/%m/%Y",
|
||||
Direction::Ltr,
|
||||
),
|
||||
locale("de-DE", "Deutsch", ('.', ','), "%d.%m.%Y", Direction::Ltr),
|
||||
locale("de-DE", "Deutsch", ('.', ','), "%d.%m.%y", Direction::Ltr),
|
||||
locale(
|
||||
"fr-FR",
|
||||
"Français",
|
||||
@@ -93,9 +93,13 @@ impl Locale {
|
||||
.unwrap_or_else(|| panic!("no locale {tag:?}"))
|
||||
}
|
||||
|
||||
/// `value` with this locale's separators.
|
||||
/// `value` with this locale's separators; a right-to-left locale leads its sign with a left-to-right mark, as CLDR does.
|
||||
pub fn number(self, value: f64, decimals: usize) -> String {
|
||||
format::number(value, decimals, self.separators)
|
||||
let number = format::number(value, decimals, self.separators);
|
||||
match (self.direction, number.starts_with(format::MINUS)) {
|
||||
(Direction::Rtl, true) => format!("\u{200e}{number}"),
|
||||
_ => number,
|
||||
}
|
||||
}
|
||||
|
||||
/// The day `at` falls on in `zone`, written as this locale writes dates.
|
||||
|
||||
Reference in new issue
Block a user