Skip to content

Commit

Permalink
[FR] Handle the 'zh-lien' template (closes #273)
Browse files Browse the repository at this point in the history
  • Loading branch information
BoboTiG committed Nov 21, 2020
1 parent 5febc23 commit 0dad99c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions scripts/lang/fr/__init__.py
Expand Up @@ -760,6 +760,13 @@ def last_template_handler(template: Tuple[str, ...], locale: str) -> str:
'Ce mot dénote une supplétion car son étymologie est distincte de celles de <i>better</i> et de <i>best</i>'
>>> last_template_handler(["supplétion", "am", "are", "was", "lang=en", "mot=oui"], "fr")
'Ce mot dénote une supplétion car son étymologie est distincte de celles de <i>am</i>, de <i>are</i> et de <i>was</i>'
>>> last_template_handler(["zh-lien", "人", "rén"], "fr")
'人 (<i>rén</i>)'
>>> last_template_handler(["zh-lien", "马", "mǎ", "馬"], "fr")
'马 (馬, <i>mǎ</i>)'
>>> last_template_handler(["zh-lien", "骨", "gǔ", "骨"], "fr")
'骨 (骨, <i>gǔ</i>)'
"""
from .langs import langs
from ..defaults import last_template_handler as default
Expand Down Expand Up @@ -976,6 +983,15 @@ def last_template_handler(template: Tuple[str, ...], locale: str) -> str:
phrase += f"celle de {italic(parts[0])}"
return phrase

# Handle the {{zh-lien}} template
if tpl == "zh-lien":
simple = parts.pop(0)
pinyin = italic(parts.pop(0))
traditional = parts[0] if parts else ""
if not traditional:
return f"{simple} ({pinyin})"
return f"{simple} ({traditional}, {pinyin})"

# This is a country in the current locale
if tpl in langs:
return langs[tpl]
Expand Down

0 comments on commit 0dad99c

Please sign in to comment.