Skip to content

Commit

Permalink
Update locale-specific data
Browse files Browse the repository at this point in the history
  • Loading branch information
BoboTiG committed Jan 10, 2025
1 parent 7eda48b commit 21b2169
Show file tree
Hide file tree
Showing 11 changed files with 152 additions and 151 deletions.
2 changes: 1 addition & 1 deletion wikidict/check_word.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def filter_html(html: str, locale: str) -> str:
elif locale == "en":
for span in bs.find_all("span"):
if span.string == "and other forms":
span.string += f' {span["title"]}'
span.string += f" {span['title']}"
# other anchors
for a in bs.find_all("a", href=True):
if a["href"].lower().startswith(("#cite", "#mw")):
Expand Down
2 changes: 1 addition & 1 deletion wikidict/lang/da/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"noun",
"personligt prononmen",
"possessivt prononmen",
"possessivt pronomen" "possessivt pronomen (ejestedord)" "præfiks",
"possessivt pronomenpossessivt pronomen (ejestedord)præfiks",
"prefix",
"pronomen",
"prœposition",
Expand Down
2 changes: 1 addition & 1 deletion wikidict/lang/el/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ def labels_output(text_in: str, *, args: dict[str, str] = defaultdict(str)) -> s
if isinstance(all_labels, list):
all_labels = all_labels[0]
if all_labels.get("link") not in {None, "πατρότητα"}:
mytext = show or f'{italic(all_labels["linkshow"])}'
mytext = show or f"{italic(all_labels['linkshow'])}"
mytext = mytext if noparenthesis else f"({mytext})"
return mytext

Expand Down
12 changes: 6 additions & 6 deletions wikidict/lang/en/template_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def render_coinage(tpl: str, parts: list[str], data: defaultdict[str, str], *, w
phrase += " "
phrase += f"{p}"
if data["in"]:
phrase += f' in {data["in"]}'
phrase += f" in {data['in']}"
return phrase


Expand Down Expand Up @@ -567,7 +567,7 @@ def render_foreign_derivation(tpl: str, parts: list[str], data: defaultdict[str,
elif word:
phrase += f" {italic(word)}"
if data["g"]:
phrase += f' {gender_number_specs(data["g"])}'
phrase += f" {gender_number_specs(data['g'])}"
trans = "" if data["tr"] else transliterate(dst_locale, word)
if parts:
gloss = parts.pop(0) # 5, t=, gloss=
Expand Down Expand Up @@ -636,7 +636,7 @@ def render_given_name(tpl: str, parts: list[str], data: defaultdict[str, str], *
"""
parts.pop(0) # language
gender = data["gender"] or (parts.pop(0) if parts else "")
gender += f' or {data["or"]}' if data["or"] else ""
gender += f" or {data['or']}" if data["or"] else ""
art = data["A"] or "A"
phrase = f"{art} "
dimtext = join_names(data, "dim", " or ", include_langname=False, key_alias="diminutive")
Expand Down Expand Up @@ -863,7 +863,7 @@ def render_lit(tpl: str, parts: list[str], data: defaultdict[str, str], *, word:
"""
starter = "Used other than figuratively or idiomatically"
if data["qualifier"]:
phrase = f'{data["qualifier"]} {starter.lower()}'
phrase = f"{data['qualifier']} {starter.lower()}"
else:
phrase = starter
parts.pop(0) # language
Expand Down Expand Up @@ -1297,7 +1297,7 @@ def render_si_unit_2(tpl: str, parts: list[str], data: defaultdict[str, str], *,
category = data["3"] or (parts.pop(0) if parts else "")
alt = data["3"] or (parts.pop(0) if parts else "")
exp = prefix_to_exp.get(prefix, "")
return f"({italic('metrology')}) An SI unit of {category} equal to 10{superscript(exp)} {unit}s; alternative spelling of {italic(prefix+alt)}."
return f"({italic('metrology')}) An SI unit of {category} equal to 10{superscript(exp)} {unit}s; alternative spelling of {italic(prefix + alt)}."


def render_si_unit_abb(tpl: str, parts: list[str], data: defaultdict[str, str], *, word: str = "") -> str:
Expand All @@ -1309,7 +1309,7 @@ def render_si_unit_abb(tpl: str, parts: list[str], data: defaultdict[str, str],
unit = data["2"] or (parts.pop(0) if parts else "")
category = data["3"] or (parts.pop(0) if parts else "")
exp = prefix_to_exp.get(prefix, "")
return f"({italic('metrology')}) {italic('Symbol for')} {strong(prefix+unit)}, an SI unit of {category} equal to 10{superscript(exp)} {unit}s"
return f"({italic('metrology')}) {italic('Symbol for')} {strong(prefix + unit)}, an SI unit of {category} equal to 10{superscript(exp)} {unit}s"


def render_surface_analysis(tpl: str, parts: list[str], data: defaultdict[str, str], *, word: str = "") -> str:
Expand Down
2 changes: 1 addition & 1 deletion wikidict/lang/eo/template_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def render_elpropra(tpl: str, parts: list[str], data: defaultdict[str, str], *,
phrase += f" {italic(ts)}"

if special := data["not"]:
phrase += f" {small('('+special+')')}"
phrase += f" {small('(' + special + ')')}"

return phrase

Expand Down
4 changes: 2 additions & 2 deletions wikidict/lang/es/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def last_template_handler(template: tuple[str, ...], locale: str, *, word: str =
added.add(local_phrase)
sindex = str(index) if index > 1 else ""
if data[f"nota{sindex}"]:
local_phrase += f' ({data[f"nota{sindex}"]})'
local_phrase += f" ({data[f'nota{sindex}']})"
else:
local_phrase = part
if index > 1 and local_phrase in lowercase_italic:
Expand All @@ -329,7 +329,7 @@ def last_template_handler(template: tuple[str, ...], locale: str, *, word: str =
append_to_last = False
else:
phrase_a.append(local_phrase)
return italic(f'({concat(phrase_a, ", ")})') if phrase_a else ""
return italic(f"({concat(phrase_a, ', ')})") if phrase_a else ""

if lang := langs.get(template[0]):
return capitalize(lang)
Expand Down
10 changes: 5 additions & 5 deletions wikidict/lang/es/template_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def render_afi(tpl: str, parts: list[str], data: defaultdict[str, str], *, word:
>>> render_afi("IPA", ["/oː/"], defaultdict(str))
'/oː/ <small>(AFI)</small>'
"""
return concat(parts, ", ") + f' {small("(AFI)")}'
return concat(parts, ", ") + f" {small('(AFI)')}"


def render_aumentativo(tpl: str, parts: list[str], data: defaultdict[str, str], *, word: str = "") -> str:
Expand Down Expand Up @@ -167,7 +167,7 @@ def render_comparativo(tpl: str, parts: list[str], data: defaultdict[str, str],
word = parts[0] if parts else ""
start = "Comparativo"
if data["tipo"]:
start += f' {data["tipo"]}'
start += f" {data['tipo']}"
if data["i"] or data["irr"] or data["irreg"] or data["irregular"]:
start += " irregular"
start += " de"
Expand Down Expand Up @@ -572,7 +572,7 @@ def render_forma(tpl: str, parts: list[str], data: defaultdict[str, str], *, wor
start = f"Forma del {concat([caso, numero, genero], ' ')} de"
phrase = f"{italic(capitalize(start))} {parts[0]}"
if data["texto_pos"]:
phrase += f'{data["texto_pos"]}'
phrase += f"{data['texto_pos']}"
return phrase


Expand Down Expand Up @@ -639,7 +639,7 @@ def render_grafia(tpl: str, parts: list[str], data: defaultdict[str, str], *, wo
phrase = f"{italic(start)} "
phrase += render_l("l", [data["alt"] or parts[0]], data)
if data["texto_pos"]:
phrase += f' {italic(data["texto_pos"])}'
phrase += f" {italic(data['texto_pos'])}"
return phrase


Expand Down Expand Up @@ -733,7 +733,7 @@ def render_superlativo(tpl: str, parts: list[str], data: defaultdict[str, str],
if data["glosa"]:
local_phrase.append(f'"{data["glosa"]}"')
if local_phrase:
phrase += f' ({concat(local_phrase, ", ")})'
phrase += f" ({concat(local_phrase, ', ')})"
if not data["def"] and not parts:
phrase += f":&nbsp;sumamente {word}"
return phrase
Expand Down
2 changes: 1 addition & 1 deletion wikidict/lang/fr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ def last_template_handler(template: tuple[str, ...], locale: str, *, word: str =
return phrase

if tpl in ("ellipse", "par ellipse"):
return f'{italic("(Ellipse de")} {data["de"]}{italic(")")}' if data["de"] else term("Par ellipse")
return f"{italic('(Ellipse de')} {data['de']}{italic(')')}" if data["de"] else term("Par ellipse")

if tpl == "R:DAF6":
w = parts[0] if parts else word
Expand Down
Loading

0 comments on commit 21b2169

Please sign in to comment.