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 9b504ed commit ff8beef
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/lang/fr/__init__.py
Expand Up @@ -758,6 +758,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 @@ -974,6 +981,14 @@ 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":
phrase = parts.pop(0)
sens = italic(parts.pop(0))
if parts:
return f"{phrase} ({parts[0]}, {sens})"
return f"{phrase} ({sens})"

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

0 comments on commit ff8beef

Please sign in to comment.