Skip to content

Commit 63dfc9a

Browse files
Pre-commit auto-fix
1 parent eb0c105 commit 63dfc9a

11 files changed

Lines changed: 347 additions & 276 deletions

File tree

.github/scripts/langCodes.py

Lines changed: 47 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,59 +2,57 @@
22

33
# Mapping between Crowdin language IDs (keys) and standard NVDA directory names (values).
44
# This dictionary acts as the symmetrical counterpart to 'languageMappings.json' implemented by @nvdaes.
5-
# It ensures that translations exported from Crowdin are stored in the correct
5+
# It ensures that translations exported from Crowdin are stored in the correct
66
# local paths (e.g., 'es-ES' from Crowdin goes into the 'es' folder).
77
CROWDIN_TO_NVDA = {
8-
# Arabic variants
9-
"ar-SA": "ar_SA",
10-
11-
# Spanish variants
12-
"es-ES": "es",
13-
"es-CO": "es_CO",
14-
15-
# Portuguese variants
16-
"pt-BR": "pt_BR",
17-
"pt-PT": "pt_PT",
18-
19-
# Chinese variants
20-
"zh-CN": "zh_CN",
21-
"zh-HK": "zh_HK",
22-
"zh-TW": "zh_TW",
23-
24-
# Other specific mappings from the NVDA ecosystem
25-
"af": "af_ZA",
26-
"de-CH": "de_CH",
27-
"nb": "nb_NO",
28-
"nn-NO": "nn_NO",
29-
"sr-CS": "sr"
8+
# Arabic variants
9+
"ar-SA": "ar_SA",
10+
# Spanish variants
11+
"es-ES": "es",
12+
"es-CO": "es_CO",
13+
# Portuguese variants
14+
"pt-BR": "pt_BR",
15+
"pt-PT": "pt_PT",
16+
# Chinese variants
17+
"zh-CN": "zh_CN",
18+
"zh-HK": "zh_HK",
19+
"zh-TW": "zh_TW",
20+
# Other specific mappings from the NVDA ecosystem
21+
"af": "af_ZA",
22+
"de-CH": "de_CH",
23+
"nb": "nb_NO",
24+
"nn-NO": "nn_NO",
25+
"sr-CS": "sr",
3026
}
3127

28+
3229
def get_nvda_code(crowdin_code):
33-
"""
34-
Returns the appropriate local directory name for a given Crowdin language ID.
35-
36-
Args:
37-
crowdin_code (str): The language identifier from Crowdin (e.g., 'pt-BR', 'fr').
38-
39-
Returns:
40-
str: The corresponding NVDA locale folder name (e.g., 'pt_BR', 'fr').
41-
"""
42-
# 1. Direct check in our verified map (Priority)
43-
if crowdin_code in CROWDIN_TO_NVDA:
44-
return CROWDIN_TO_NVDA[crowdin_code]
45-
46-
# 2. Automated conversion for regional variants: Crowdin "xx-YY" -> NVDA "xx_YY"
47-
# This handles regional codes not explicitly defined in the map.
48-
if "-" in crowdin_code:
49-
return crowdin_code.replace("-", "_")
50-
51-
# 3. Default: Return as is.
52-
# This covers base languages that don't use regional folders in NVDA
53-
# (e.g., 'fr', 'tr', 'bg', 'fi', 'fa').
54-
return crowdin_code
30+
"""
31+
Returns the appropriate local directory name for a given Crowdin language ID.
32+
33+
Args:
34+
crowdin_code (str): The language identifier from Crowdin (e.g., 'pt-BR', 'fr').
35+
36+
Returns:
37+
str: The corresponding NVDA locale folder name (e.g., 'pt_BR', 'fr').
38+
"""
39+
# 1. Direct check in our verified map (Priority)
40+
if crowdin_code in CROWDIN_TO_NVDA:
41+
return CROWDIN_TO_NVDA[crowdin_code]
42+
43+
# 2. Automated conversion for regional variants: Crowdin "xx-YY" -> NVDA "xx_YY"
44+
# This handles regional codes not explicitly defined in the map.
45+
if "-" in crowdin_code:
46+
return crowdin_code.replace("-", "_")
47+
48+
# 3. Default: Return as is.
49+
# This covers base languages that don't use regional folders in NVDA
50+
# (e.g., 'fr', 'tr', 'bg', 'fi', 'fa').
51+
return crowdin_code
52+
5553

5654
if __name__ == "__main__":
57-
# Ensure a language code was provided as a command-line argument
58-
if len(sys.argv) > 1:
59-
# Standardize input and output the mapped code for PowerShell to capture
60-
print(get_nvda_code(sys.argv[1]))
55+
# Ensure a language code was provided as a command-line argument
56+
if len(sys.argv) > 1:
57+
# Standardize input and output the mapped code for PowerShell to capture
58+
print(get_nvda_code(sys.argv[1]))

.github/workflows/auto-update-translations.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ on:
1111
jobs:
1212
auto_update_translations:
1313
uses: abdel792/autoUpdateTranslations/.github/workflows/l10n-updates.yaml@8ac89c644395cf2aad6e03a4bb2be5c36526d12a
14-

.github/workflows/manual-release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ jobs:
119119
f.seek(0)
120120
f.write(text)
121121
f.truncate()
122-
shell: python
122+
shell: python
123123

124124

125125
- name: Check if there are any changes

0 commit comments

Comments
 (0)