Hebrew: format expanded dates as 'D ל-M Y'
Browse files
app.py
CHANGED
|
@@ -807,6 +807,8 @@ def expand_ratios(text: str, lang: str = "en") -> str:
|
|
| 807 |
|
| 808 |
def expand_dates(text: str, lang: str = "en") -> str:
|
| 809 |
"""Normalize numeric day/month/year dates before generic number expansion."""
|
|
|
|
|
|
|
| 810 |
def repl(m: re.Match[str]) -> str:
|
| 811 |
day = int(m.group(1))
|
| 812 |
month = int(m.group(2))
|
|
@@ -816,6 +818,8 @@ def expand_dates(text: str, lang: str = "en") -> str:
|
|
| 816 |
year = int(raw_year)
|
| 817 |
if len(raw_year) == 2:
|
| 818 |
year += 2000 if year < 70 else 1900
|
|
|
|
|
|
|
| 819 |
return f"{day} {month} {year}"
|
| 820 |
|
| 821 |
return _DATE_RE.sub(repl, text)
|
|
|
|
| 807 |
|
| 808 |
def expand_dates(text: str, lang: str = "en") -> str:
|
| 809 |
"""Normalize numeric day/month/year dates before generic number expansion."""
|
| 810 |
+
lang = _canonical_lang(lang)
|
| 811 |
+
|
| 812 |
def repl(m: re.Match[str]) -> str:
|
| 813 |
day = int(m.group(1))
|
| 814 |
month = int(m.group(2))
|
|
|
|
| 818 |
year = int(raw_year)
|
| 819 |
if len(raw_year) == 2:
|
| 820 |
year += 2000 if year < 70 else 1900
|
| 821 |
+
if lang == "he":
|
| 822 |
+
return f"{day} ל-{month} {year}"
|
| 823 |
return f"{day} {month} {year}"
|
| 824 |
|
| 825 |
return _DATE_RE.sub(repl, text)
|