Skip to content

Commit d14ef4e

Browse files
committed
fix: code spelling
Enable codespell and fix found typos.
1 parent 816b554 commit d14ef4e

File tree

9 files changed

+22
-12
lines changed

9 files changed

+22
-12
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ repos:
6262
hooks:
6363
- id: reuse
6464

65+
- repo: https://github.com/codespell-project/codespell
66+
rev: v2.4.1
67+
hooks:
68+
- id: codespell
69+
additional_dependencies:
70+
- tomli
6571
- repo: https://github.com/rhysd/actionlint
6672
rev: v1.7.7
6773
hooks:

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ ignore-bad-ideas = [
9595
"modules/gettext/gettext-tools/tests/*.mo"
9696
]
9797

98+
[tool.codespell]
99+
builtin = "clear,rare,informal,usage"
100+
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'
101+
98102
[tool.isort]
99103
profile = "black"
100104

scripts/export-cldr-orientation

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ for layout_file in LAYOUTDIR.glob("*/layout.json"):
3535
if character_order == "right-to-left":
3636
RTL_CODES.add(code)
3737
elif character_order != "left-to-right":
38-
print(f"Uknown order for {code}: {character_order})")
38+
print(f"Unknown order for {code}: {character_order})")
3939

4040
with open("rtl.csv", "w") as handle:
4141
handle.write("code,\n")

scripts/export-iso-aliases

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ with open(ALIASES) as handle:
7171
continue
7272
replacement = alias["_replacement"]
7373
if code in LANGUAGE_CODES:
74-
print(f"Exising language {code}: {alias}")
74+
print(f"Existing language {code}: {alias}")
7575
continue
7676
if replacement not in LANGUAGE_CODES:
7777
print(f"Missing target {code}: {alias}")

scripts/generate-language-data

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ with open("rtl.csv") as csvfile:
150150
RTLS = list(reader)
151151
RTL_CODES = {lang[0] for lang in RTLS}
152152

153-
# Read case insentive
153+
# Read case-insensitive
154154
with open("case-insensitive.csv") as csvfile:
155155
reader = csv.reader(csvfile, delimiter=",")
156156
next(reader)
@@ -201,7 +201,7 @@ with open("weblate_language_data/aliases.py", "w") as output:
201201
output.write("}\n")
202202
with open("weblate_language_data/countries.py", "w") as output:
203203
output.write(HEADER)
204-
output.write("# List of defaul languages, omitting country code should be okay\n")
204+
output.write("# List of default languages, omitting country code should be okay\n")
205205
output.write("DEFAULT_LANGS: tuple[str, ...] = (\n")
206206
for row in DEFAULT_COUNTRIES:
207207
output.write(f' "{escape(row[0])}",\n')
@@ -216,13 +216,13 @@ with open("weblate_language_data/rtl.py", "w") as output:
216216

217217
with open("weblate_language_data/case_insensitive.py", "w") as output:
218218
output.write(HEADER)
219-
output.write("# List of case-insentive languages\n")
219+
output.write("# List of case-insensitive languages\n")
220220
output.write("CASE_INSENSITIVE_LANGS: set[str] = {\n")
221221
for code in sorted(CASE_INSENSITIVE_CODES):
222222
output.write(f' "{code}",\n')
223223
output.write("}\n")
224224

225-
# Generate same check blacklist
225+
# Generate same check exception list
226226
words = set()
227227

228228

@@ -310,10 +310,10 @@ words.difference_update(
310310
},
311311
)
312312

313-
# Write same check blacklist
313+
# Write same check exclude list
314314
with open("weblate_language_data/check_languages.py", "w") as output:
315315
output.write(HEADER)
316-
output.write("# Language names to ignore in same check\n")
316+
output.write("# Language names to ignore in the same check\n")
317317
output.write("LANGUAGES: set[str] = {\n")
318318
for word in sorted(words):
319319
if len(word) <= 2: # noqa: PLR2004

scripts/lint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if missing:
3939

4040
overlap = set(languages.keys()) & set(aliases.keys())
4141
if overlap:
42-
raise ValueError(f"Overlaping languages and aliases: {overlap}")
42+
raise ValueError(f"Overlapping languages and aliases: {overlap}")
4343

4444
missing = set(cldr.keys()) - set(languages.keys())
4545
# Remove aliases (these use lower case)

weblate_language_data/case_insensitive.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"""
1313
# pylint: disable=line-too-long,too-many-lines
1414

15-
# List of case-insentive languages
15+
# List of case-insensitive languages
1616
CASE_INSENSITIVE_LANGS: set[str] = {
1717
"aeb",
1818
"am",

weblate_language_data/check_languages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"""
1313
# pylint: disable=line-too-long,too-many-lines
1414

15-
# Language names to ignore in same check
15+
# Language names to ignore in the same check
1616
LANGUAGES: set[str] = {
1717
"aak",
1818
"aakkâr",

weblate_language_data/countries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"""
1313
# pylint: disable=line-too-long,too-many-lines
1414

15-
# List of defaul languages, omitting country code should be okay
15+
# List of default languages, omitting country code should be okay
1616
DEFAULT_LANGS: tuple[str, ...] = (
1717
"af_za",
1818
"am_et",

0 commit comments

Comments
 (0)