mirror of
https://gh.llkk.cc/https://github.com/WeblateOrg/language-data.git
synced 2025-10-03 15:01:09 +08:00
fix: code spelling
Enable codespell and fix found typos.
This commit is contained in:
parent
816b554125
commit
d14ef4ed10
9 changed files with 22 additions and 12 deletions
|
@ -62,6 +62,12 @@ repos:
|
|||
hooks:
|
||||
- id: reuse
|
||||
|
||||
- repo: https://github.com/codespell-project/codespell
|
||||
rev: v2.4.1
|
||||
hooks:
|
||||
- id: codespell
|
||||
additional_dependencies:
|
||||
- tomli
|
||||
- repo: https://github.com/rhysd/actionlint
|
||||
rev: v1.7.7
|
||||
hooks:
|
||||
|
|
|
@ -95,6 +95,10 @@ ignore-bad-ideas = [
|
|||
"modules/gettext/gettext-tools/tests/*.mo"
|
||||
]
|
||||
|
||||
[tool.codespell]
|
||||
builtin = "clear,rare,informal,usage"
|
||||
skip = '*.po,*.pot,*.csv,weblate_language_data/aliases.py,weblate_language_data/population.py,weblate_language_data/plurals.py,weblate_language_data/language_codes.py,weblate_language_data/languages.py,weblate_language_data/check_languages.py,weblate_language_data/plural_tags.py,PLURALS_DIFF.md,weblate_language_data/case_insensitive.py,weblate_language_data/country_codes.py'
|
||||
|
||||
[tool.isort]
|
||||
profile = "black"
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ for layout_file in LAYOUTDIR.glob("*/layout.json"):
|
|||
if character_order == "right-to-left":
|
||||
RTL_CODES.add(code)
|
||||
elif character_order != "left-to-right":
|
||||
print(f"Uknown order for {code}: {character_order})")
|
||||
print(f"Unknown order for {code}: {character_order})")
|
||||
|
||||
with open("rtl.csv", "w") as handle:
|
||||
handle.write("code,\n")
|
||||
|
|
|
@ -71,7 +71,7 @@ with open(ALIASES) as handle:
|
|||
continue
|
||||
replacement = alias["_replacement"]
|
||||
if code in LANGUAGE_CODES:
|
||||
print(f"Exising language {code}: {alias}")
|
||||
print(f"Existing language {code}: {alias}")
|
||||
continue
|
||||
if replacement not in LANGUAGE_CODES:
|
||||
print(f"Missing target {code}: {alias}")
|
||||
|
|
|
@ -150,7 +150,7 @@ with open("rtl.csv") as csvfile:
|
|||
RTLS = list(reader)
|
||||
RTL_CODES = {lang[0] for lang in RTLS}
|
||||
|
||||
# Read case insentive
|
||||
# Read case-insensitive
|
||||
with open("case-insensitive.csv") as csvfile:
|
||||
reader = csv.reader(csvfile, delimiter=",")
|
||||
next(reader)
|
||||
|
@ -201,7 +201,7 @@ with open("weblate_language_data/aliases.py", "w") as output:
|
|||
output.write("}\n")
|
||||
with open("weblate_language_data/countries.py", "w") as output:
|
||||
output.write(HEADER)
|
||||
output.write("# List of defaul languages, omitting country code should be okay\n")
|
||||
output.write("# List of default languages, omitting country code should be okay\n")
|
||||
output.write("DEFAULT_LANGS: tuple[str, ...] = (\n")
|
||||
for row in DEFAULT_COUNTRIES:
|
||||
output.write(f' "{escape(row[0])}",\n')
|
||||
|
@ -216,13 +216,13 @@ with open("weblate_language_data/rtl.py", "w") as output:
|
|||
|
||||
with open("weblate_language_data/case_insensitive.py", "w") as output:
|
||||
output.write(HEADER)
|
||||
output.write("# List of case-insentive languages\n")
|
||||
output.write("# List of case-insensitive languages\n")
|
||||
output.write("CASE_INSENSITIVE_LANGS: set[str] = {\n")
|
||||
for code in sorted(CASE_INSENSITIVE_CODES):
|
||||
output.write(f' "{code}",\n')
|
||||
output.write("}\n")
|
||||
|
||||
# Generate same check blacklist
|
||||
# Generate same check exception list
|
||||
words = set()
|
||||
|
||||
|
||||
|
@ -310,10 +310,10 @@ words.difference_update(
|
|||
},
|
||||
)
|
||||
|
||||
# Write same check blacklist
|
||||
# Write same check exclude list
|
||||
with open("weblate_language_data/check_languages.py", "w") as output:
|
||||
output.write(HEADER)
|
||||
output.write("# Language names to ignore in same check\n")
|
||||
output.write("# Language names to ignore in the same check\n")
|
||||
output.write("LANGUAGES: set[str] = {\n")
|
||||
for word in sorted(words):
|
||||
if len(word) <= 2: # noqa: PLR2004
|
||||
|
|
|
@ -39,7 +39,7 @@ if missing:
|
|||
|
||||
overlap = set(languages.keys()) & set(aliases.keys())
|
||||
if overlap:
|
||||
raise ValueError(f"Overlaping languages and aliases: {overlap}")
|
||||
raise ValueError(f"Overlapping languages and aliases: {overlap}")
|
||||
|
||||
missing = set(cldr.keys()) - set(languages.keys())
|
||||
# Remove aliases (these use lower case)
|
||||
|
|
|
@ -12,7 +12,7 @@ https://github.com/WeblateOrg/language-data
|
|||
"""
|
||||
# pylint: disable=line-too-long,too-many-lines
|
||||
|
||||
# List of case-insentive languages
|
||||
# List of case-insensitive languages
|
||||
CASE_INSENSITIVE_LANGS: set[str] = {
|
||||
"aeb",
|
||||
"am",
|
||||
|
|
|
@ -12,7 +12,7 @@ https://github.com/WeblateOrg/language-data
|
|||
"""
|
||||
# pylint: disable=line-too-long,too-many-lines
|
||||
|
||||
# Language names to ignore in same check
|
||||
# Language names to ignore in the same check
|
||||
LANGUAGES: set[str] = {
|
||||
"aak",
|
||||
"aakkâr",
|
||||
|
|
|
@ -12,7 +12,7 @@ https://github.com/WeblateOrg/language-data
|
|||
"""
|
||||
# pylint: disable=line-too-long,too-many-lines
|
||||
|
||||
# List of defaul languages, omitting country code should be okay
|
||||
# List of default languages, omitting country code should be okay
|
||||
DEFAULT_LANGS: tuple[str, ...] = (
|
||||
"af_za",
|
||||
"am_et",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue