build: add translations
This commit is contained in:
parent
1772b4cfbc
commit
2a3a76bd4d
56 changed files with 63620 additions and 1679 deletions
1224
lib/l10n/intl_ar.arb
1224
lib/l10n/intl_ar.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_be.arb
1224
lib/l10n/intl_be.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_bn.arb
1224
lib/l10n/intl_bn.arb
File diff suppressed because it is too large
Load diff
1226
lib/l10n/intl_bo.arb
1226
lib/l10n/intl_bo.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_ca.arb
1224
lib/l10n/intl_ca.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_cs.arb
1224
lib/l10n/intl_cs.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_da.arb
1224
lib/l10n/intl_da.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_de.arb
1224
lib/l10n/intl_de.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_el.arb
1224
lib/l10n/intl_el.arb
File diff suppressed because it is too large
Load diff
|
|
@ -3371,12 +3371,6 @@
|
|||
},
|
||||
"oneWeekTrial": "One Week Trial",
|
||||
"downloadXLSXFile": "Download Excel File",
|
||||
"abDisplayName": "Abkhaz",
|
||||
"aaDisplayName": "Afar",
|
||||
"ceDisplayName": "Chechen",
|
||||
"etDisplayName": "Estonian",
|
||||
"elDisplayName": "Greek, Modern",
|
||||
"rmDisplayName": "Romansh",
|
||||
"unkDisplayName": "Unknown",
|
||||
"wwCountryDisplayName": "World Wide",
|
||||
"afCountryDisplayName": "Afghanistan",
|
||||
|
|
@ -4735,5 +4729,224 @@
|
|||
"subscriptionEndsOn": "Subscription Ends On",
|
||||
"subscriptionRenewsOn": "Subscription Renews On",
|
||||
"waitForSubscriptionChanges": "Changes to your subscription may take a moment to reflect in the app.",
|
||||
"subscribeReadingAssistance": "Subscribe to unlock message tools"
|
||||
"subscribeReadingAssistance": "Subscribe to unlock message tools",
|
||||
"aceDisplayName": "Achinese",
|
||||
"achDisplayName": "Acoli",
|
||||
"afDisplayName": "Afrikaans",
|
||||
"akDisplayName": "Akan",
|
||||
"alzDisplayName": "Alur",
|
||||
"amDisplayName": "Amharic",
|
||||
"arDisplayName": "Arabic",
|
||||
"asDisplayName": "Assamese",
|
||||
"awaDisplayName": "Awadhi",
|
||||
"ayDisplayName": "Aymara",
|
||||
"azDisplayName": "Azerbaijani",
|
||||
"baDisplayName": "Bashkir",
|
||||
"banDisplayName": "Balinese",
|
||||
"bbcDisplayName": "Batak Toba",
|
||||
"beDisplayName": "Belarusian",
|
||||
"bemDisplayName": "Bemba",
|
||||
"bewDisplayName": "Betawi",
|
||||
"bgDisplayName": "Bulgarian",
|
||||
"bhoDisplayName": "Bhojpuri",
|
||||
"bikDisplayName": "Bikol",
|
||||
"bmDisplayName": "Bambara",
|
||||
"bnDisplayName": "Bangla",
|
||||
"bnBDDisplayName": "Bengali (Bangladesh)",
|
||||
"bnINDisplayName": "Bengali (India)",
|
||||
"brDisplayName": "Breton",
|
||||
"bsDisplayName": "Bosnian",
|
||||
"btsDisplayName": "Batak Simalungun",
|
||||
"btxDisplayName": "Batak Karo",
|
||||
"buaDisplayName": "Buriat",
|
||||
"caDisplayName": "Catalan",
|
||||
"cebDisplayName": "Cebuano",
|
||||
"cggDisplayName": "Chiga",
|
||||
"chmDisplayName": "Mari",
|
||||
"ckbDisplayName": "Central Kurdish",
|
||||
"cnhDisplayName": "Hakha Chin",
|
||||
"coDisplayName": "Corsican",
|
||||
"crhDisplayName": "Crimean Turkish",
|
||||
"crsDisplayName": "Seselwa Creole French",
|
||||
"csDisplayName": "Czech",
|
||||
"cvDisplayName": "Chuvash",
|
||||
"cyDisplayName": "Welsh",
|
||||
"daDisplayName": "Danish",
|
||||
"deDisplayName": "German",
|
||||
"dinDisplayName": "Dinka",
|
||||
"doiDisplayName": "Dogri",
|
||||
"dovDisplayName": "Dombe",
|
||||
"dzDisplayName": "Dzongkha",
|
||||
"eeDisplayName": "Ewe",
|
||||
"enDisplayName": "English",
|
||||
"enAUDisplayName": "English (Australia)",
|
||||
"enGBDisplayName": "English (UK)",
|
||||
"enINDisplayName": "English (India)",
|
||||
"enUSDisplayName": "English (US)",
|
||||
"eoDisplayName": "Esperanto",
|
||||
"esDisplayName": "Spanish",
|
||||
"esESDisplayName": "Spanish (Spain)",
|
||||
"esMXDisplayName": "Spanish (Mexico)",
|
||||
"euDisplayName": "Basque",
|
||||
"faDisplayName": "Persian",
|
||||
"ffDisplayName": "Fulah",
|
||||
"fiDisplayName": "Finnish",
|
||||
"filDisplayName": "Filipino",
|
||||
"fjDisplayName": "Fijian",
|
||||
"foDisplayName": "Faroese",
|
||||
"frDisplayName": "French",
|
||||
"frCADisplayName": "French (Canada)",
|
||||
"frFRDisplayName": "French (France)",
|
||||
"fyDisplayName": "Western Frisian",
|
||||
"gaDisplayName": "Irish",
|
||||
"gaaDisplayName": "Ga",
|
||||
"gdDisplayName": "Scottish Gaelic",
|
||||
"glDisplayName": "Galician",
|
||||
"gnDisplayName": "Guarani",
|
||||
"gomDisplayName": "Goan Konkani",
|
||||
"guDisplayName": "Gujarati",
|
||||
"haDisplayName": "Hausa",
|
||||
"hawDisplayName": "Hawaiian",
|
||||
"heDisplayName": "Hebrew",
|
||||
"hiDisplayName": "Hindi",
|
||||
"hilDisplayName": "Hiligaynon",
|
||||
"hmnDisplayName": "Hmong",
|
||||
"hneDisplayName": "Chhattisgarhi",
|
||||
"hrDisplayName": "Croatian",
|
||||
"hrxDisplayName": "Hunsrik",
|
||||
"htDisplayName": "Haitian Creole",
|
||||
"huDisplayName": "Hungarian",
|
||||
"hyDisplayName": "Armenian",
|
||||
"idDisplayName": "Indonesian",
|
||||
"igDisplayName": "Igbo",
|
||||
"iloDisplayName": "Iloko",
|
||||
"isDisplayName": "Icelandic",
|
||||
"itDisplayName": "Italian",
|
||||
"jaDisplayName": "Japanese",
|
||||
"jvDisplayName": "Javanese",
|
||||
"kaDisplayName": "Georgian",
|
||||
"kkDisplayName": "Kazakh",
|
||||
"kmDisplayName": "Khmer",
|
||||
"knDisplayName": "Kannada",
|
||||
"koDisplayName": "Korean",
|
||||
"kokDisplayName": "Konkani",
|
||||
"kriDisplayName": "Krio",
|
||||
"ksDisplayName": "Kashmiri",
|
||||
"ktuDisplayName": "Kituba (Democratic Republic of Congo)",
|
||||
"kuDisplayName": "Kurdish",
|
||||
"kyDisplayName": "Kyrgyz",
|
||||
"laDisplayName": "Latin",
|
||||
"lbDisplayName": "Luxembourgish",
|
||||
"lgDisplayName": "Ganda",
|
||||
"liDisplayName": "Limburgish",
|
||||
"lijDisplayName": "Ligurian",
|
||||
"lmoDisplayName": "Lombard",
|
||||
"lnDisplayName": "Lingala",
|
||||
"loDisplayName": "Lao",
|
||||
"ltDisplayName": "Lithuanian",
|
||||
"ltgDisplayName": "Latgalian",
|
||||
"luoDisplayName": "Luo (Kenya and Tanzania)",
|
||||
"lusDisplayName": "Mizo",
|
||||
"lvDisplayName": "Latvian",
|
||||
"maiDisplayName": "Maithili",
|
||||
"makDisplayName": "Makasar",
|
||||
"mgDisplayName": "Malagasy",
|
||||
"miDisplayName": "Māori",
|
||||
"minDisplayName": "Minangkabau",
|
||||
"mkDisplayName": "Macedonian",
|
||||
"mlDisplayName": "Malayalam",
|
||||
"mnDisplayName": "Mongolian",
|
||||
"mniDisplayName": "Manipuri",
|
||||
"mrDisplayName": "Marathi",
|
||||
"msDisplayName": "Malay",
|
||||
"msArabDisplayName": "Malay (Arabic)",
|
||||
"msMYDisplayName": "Malay (Malaysia)",
|
||||
"mtDisplayName": "Maltese",
|
||||
"mwrDisplayName": "Marwari",
|
||||
"myDisplayName": "Burmese",
|
||||
"nanDisplayName": "Min Nan",
|
||||
"nbDisplayName": "Norwegian (Bokmål)",
|
||||
"neDisplayName": "Nepali",
|
||||
"newDisplayName": "Newari",
|
||||
"nlDisplayName": "Dutch",
|
||||
"nlBEDisplayName": "Flemish",
|
||||
"noDisplayName": "Norwegian",
|
||||
"nrDisplayName": "South Ndebele",
|
||||
"nsoDisplayName": "Northern Sotho",
|
||||
"nusDisplayName": "Nuer",
|
||||
"nyDisplayName": "Nyanja",
|
||||
"ocDisplayName": "Occitan",
|
||||
"omDisplayName": "Oromo",
|
||||
"orDisplayName": "Odia",
|
||||
"paDisplayName": "Punjabi",
|
||||
"paArabDisplayName": "Punjabi (Shahmukhi)",
|
||||
"paINDisplayName": "Punjabi (Gurmukhi)",
|
||||
"pagDisplayName": "Pangasinan",
|
||||
"pamDisplayName": "Pampanga",
|
||||
"papDisplayName": "Papiamento",
|
||||
"plDisplayName": "Polish",
|
||||
"psDisplayName": "Pashto",
|
||||
"ptDisplayName": "Portuguese",
|
||||
"ptBRDisplayName": "Portuguese (Brazil)",
|
||||
"ptPTDisplayName": "Portuguese (Portugal)",
|
||||
"quDisplayName": "Quechua",
|
||||
"rajDisplayName": "Rajasthani",
|
||||
"rnDisplayName": "Rundi",
|
||||
"roDisplayName": "Romanian",
|
||||
"roMDDisplayName": "Moldovan",
|
||||
"romDisplayName": "Romany",
|
||||
"ruDisplayName": "Russian",
|
||||
"rwDisplayName": "Kinyarwanda",
|
||||
"saDisplayName": "Sanskrit",
|
||||
"satDisplayName": "Santali",
|
||||
"scnDisplayName": "Sicilian",
|
||||
"sdDisplayName": "Sindhi",
|
||||
"sgDisplayName": "Sango",
|
||||
"shnDisplayName": "Shan",
|
||||
"siDisplayName": "Sinhala",
|
||||
"skDisplayName": "Slovak",
|
||||
"slDisplayName": "Slovenian",
|
||||
"smDisplayName": "Samoan",
|
||||
"snDisplayName": "Shona",
|
||||
"soDisplayName": "Somali",
|
||||
"sqDisplayName": "Albanian",
|
||||
"srDisplayName": "Serbian",
|
||||
"srMEDisplayName": "Montenegrin",
|
||||
"ssDisplayName": "Swati",
|
||||
"stDisplayName": "Southern Sotho",
|
||||
"suDisplayName": "Sundanese",
|
||||
"svDisplayName": "Swedish",
|
||||
"swDisplayName": "Swahili",
|
||||
"szlDisplayName": "Silesian",
|
||||
"taDisplayName": "Tamil",
|
||||
"teDisplayName": "Telugu",
|
||||
"tetDisplayName": "Tetum",
|
||||
"tgDisplayName": "Tajik",
|
||||
"thDisplayName": "Thai",
|
||||
"tiDisplayName": "Tigrinya",
|
||||
"tkDisplayName": "Turkmen",
|
||||
"tlDisplayName": "Tagalog",
|
||||
"tnDisplayName": "Tswana",
|
||||
"trDisplayName": "Turkish",
|
||||
"tsDisplayName": "Tsonga",
|
||||
"ttDisplayName": "Tatar",
|
||||
"ugDisplayName": "Uyghur",
|
||||
"ukDisplayName": "Ukrainian",
|
||||
"urDisplayName": "Urdu",
|
||||
"urINDisplayName": "Urdu (India)",
|
||||
"urPKDisplayName": "Urdu (Pakistan)",
|
||||
"uzDisplayName": "Uzbek",
|
||||
"viDisplayName": "Vietnamese",
|
||||
"wuuDisplayName": "Wu",
|
||||
"xhDisplayName": "Xhosa",
|
||||
"yiDisplayName": "Yiddish",
|
||||
"yoDisplayName": "Yoruba",
|
||||
"yuaDisplayName": "Yucateco",
|
||||
"yueDisplayName": "Cantonese",
|
||||
"yueCNDisplayName": "Cantonese (China)",
|
||||
"yueHKDisplayName": "Cantonese (Hong Kong)",
|
||||
"zhDisplayName": "Chinese",
|
||||
"zhCNDisplayName": "Chinese (Simplified)",
|
||||
"zhTWDisplayName": "Chinese (Traditional)",
|
||||
"zuDisplayName": "Zulu"
|
||||
}
|
||||
|
|
|
|||
1224
lib/l10n/intl_eo.arb
1224
lib/l10n/intl_eo.arb
File diff suppressed because it is too large
Load diff
1201
lib/l10n/intl_es.arb
1201
lib/l10n/intl_es.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_et.arb
1224
lib/l10n/intl_et.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_eu.arb
1224
lib/l10n/intl_eu.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_fa.arb
1224
lib/l10n/intl_fa.arb
File diff suppressed because it is too large
Load diff
1246
lib/l10n/intl_fi.arb
1246
lib/l10n/intl_fi.arb
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_fr.arb
1224
lib/l10n/intl_fr.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_ga.arb
1224
lib/l10n/intl_ga.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_gl.arb
1224
lib/l10n/intl_gl.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_he.arb
1224
lib/l10n/intl_he.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_hi.arb
1224
lib/l10n/intl_hi.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_hr.arb
1224
lib/l10n/intl_hr.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_hu.arb
1224
lib/l10n/intl_hu.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_ia.arb
1224
lib/l10n/intl_ia.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_id.arb
1224
lib/l10n/intl_id.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_ie.arb
1224
lib/l10n/intl_ie.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_it.arb
1224
lib/l10n/intl_it.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_ja.arb
1224
lib/l10n/intl_ja.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_ka.arb
1224
lib/l10n/intl_ka.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_ko.arb
1224
lib/l10n/intl_ko.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_lt.arb
1224
lib/l10n/intl_lt.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_lv.arb
1224
lib/l10n/intl_lv.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_nb.arb
1224
lib/l10n/intl_nb.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_nl.arb
1224
lib/l10n/intl_nl.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_pl.arb
1224
lib/l10n/intl_pl.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_pt.arb
1224
lib/l10n/intl_pt.arb
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_ro.arb
1224
lib/l10n/intl_ro.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_ru.arb
1224
lib/l10n/intl_ru.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_sk.arb
1224
lib/l10n/intl_sk.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_sl.arb
1224
lib/l10n/intl_sl.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_sr.arb
1224
lib/l10n/intl_sr.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_sv.arb
1224
lib/l10n/intl_sv.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_ta.arb
1224
lib/l10n/intl_ta.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_te.arb
1224
lib/l10n/intl_te.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_th.arb
1224
lib/l10n/intl_th.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_tr.arb
1224
lib/l10n/intl_tr.arb
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_uk.arb
1224
lib/l10n/intl_uk.arb
File diff suppressed because it is too large
Load diff
1200
lib/l10n/intl_vi.arb
1200
lib/l10n/intl_vi.arb
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
1224
lib/l10n/intl_zh.arb
1224
lib/l10n/intl_zh.arb
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
46
scripts/REMOVE_INTL_KEY.md
Normal file
46
scripts/REMOVE_INTL_KEY.md
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# Remove Translation Key Script
|
||||
|
||||
This script removes a specific translation key from all `.arb` files in the project.
|
||||
|
||||
## Usage
|
||||
|
||||
```bash
|
||||
python3 scripts/remove_intl_key.py <key_name>
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
```bash
|
||||
python3 scripts/remove_intl_key.py "obsoleteKey"
|
||||
```
|
||||
|
||||
## What it does
|
||||
|
||||
1. **Takes a key name** as a command-line argument
|
||||
2. **Validates the key name** and cleans it (removes @ prefix if accidentally provided)
|
||||
3. **Searches all .arb files** in `lib/l10n/` directory
|
||||
4. **Removes both the key and its metadata**:
|
||||
- The main key-value pair (e.g., `"myKey": "My Value"`)
|
||||
- The associated metadata entry (e.g., `"@myKey": {...}`)
|
||||
5. **Preserves file structure** and formatting
|
||||
6. **Provides detailed feedback** about what was removed
|
||||
|
||||
## Safety Features
|
||||
|
||||
- **Confirmation prompt** before making changes
|
||||
- **Validates input** to prevent common mistakes
|
||||
- **Detailed reporting** of what was removed from each file
|
||||
- **Preserves JSON structure** and formatting
|
||||
- **Only modifies files** that actually contain the key
|
||||
|
||||
## Output
|
||||
|
||||
The script provides:
|
||||
- A list of processed files and what was removed from each
|
||||
- Summary of total entries removed
|
||||
- Warning if the key wasn't found in any files
|
||||
|
||||
## Related Scripts
|
||||
|
||||
- `find_unused_intl_keys.py` - Finds keys that are not used in the codebase
|
||||
- `remove_unused_intl_keys.py` - Removes all unused keys at once
|
||||
177
scripts/remove_intl_key.py
Executable file
177
scripts/remove_intl_key.py
Executable file
|
|
@ -0,0 +1,177 @@
|
|||
#!/usr/bin/env python3
|
||||
"""
|
||||
Script to remove a specific translation key from all .arb files.
|
||||
|
||||
This script:
|
||||
1. Takes a key name as a command-line argument
|
||||
2. Removes that key and its metadata entry from all .arb files
|
||||
3. Preserves the overall order and structure of the files
|
||||
|
||||
Usage:
|
||||
python3 scripts/remove_intl_key.py <key_name>
|
||||
|
||||
Example:
|
||||
python3 scripts/remove_intl_key.py "obsoleteKey"
|
||||
|
||||
Input:
|
||||
key_name - The name of the key to remove (without the @ prefix for metadata)
|
||||
|
||||
Output:
|
||||
Updates all .arb files in lib/l10n/ by removing the specified key and its metadata
|
||||
"""
|
||||
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from collections import OrderedDict
|
||||
|
||||
|
||||
def remove_key_from_arb_file(arb_file_path: str, key_to_remove: str) -> int:
|
||||
"""
|
||||
Remove a specific key and its metadata from an .arb file.
|
||||
|
||||
This function removes both the key-value pair and its corresponding
|
||||
metadata entry (which is prefixed with @).
|
||||
|
||||
Args:
|
||||
arb_file_path: Path to the .arb file
|
||||
key_to_remove: Name of the key to remove
|
||||
|
||||
Returns:
|
||||
Number of entries removed from this file (0-2: key and/or metadata)
|
||||
"""
|
||||
# Read the JSON file
|
||||
with open(arb_file_path, 'r', encoding='utf-8') as f:
|
||||
data = json.load(f, object_pairs_hook=OrderedDict)
|
||||
|
||||
# Track what we remove
|
||||
removed_count = 0
|
||||
keys_to_delete = []
|
||||
|
||||
# Check if the main key exists
|
||||
if key_to_remove in data:
|
||||
keys_to_delete.append(key_to_remove)
|
||||
removed_count += 1
|
||||
|
||||
# Check if the metadata key exists
|
||||
metadata_key = f"@{key_to_remove}"
|
||||
if metadata_key in data:
|
||||
keys_to_delete.append(metadata_key)
|
||||
removed_count += 1
|
||||
|
||||
# Remove the keys
|
||||
for key in keys_to_delete:
|
||||
del data[key]
|
||||
|
||||
# Only write back if we actually removed something
|
||||
if removed_count > 0:
|
||||
with open(arb_file_path, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, indent=2, ensure_ascii=False)
|
||||
f.write('\n') # Add trailing newline
|
||||
|
||||
return removed_count
|
||||
|
||||
|
||||
def validate_key_name(key_name: str) -> str:
|
||||
"""
|
||||
Validate and clean the key name.
|
||||
|
||||
Args:
|
||||
key_name: The key name provided by the user
|
||||
|
||||
Returns:
|
||||
Cleaned key name (without @ prefix if it was provided)
|
||||
|
||||
Raises:
|
||||
ValueError: If the key name is invalid
|
||||
"""
|
||||
if not key_name:
|
||||
raise ValueError("Key name cannot be empty")
|
||||
|
||||
# Remove @ prefix if user accidentally included it
|
||||
if key_name.startswith('@'):
|
||||
key_name = key_name[1:]
|
||||
|
||||
# Check if key name is still valid after cleaning
|
||||
if not key_name:
|
||||
raise ValueError("Key name cannot be just '@'")
|
||||
|
||||
# Validate key name format (basic validation)
|
||||
if not key_name.replace('_', '').replace('-', '').isalnum():
|
||||
print(f"Warning: Key name '{key_name}' contains special characters. This might not match any existing keys.")
|
||||
|
||||
return key_name
|
||||
|
||||
|
||||
def main():
|
||||
"""Main function to remove a specific key from all .arb files."""
|
||||
# Check command line arguments
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python3 scripts/remove_intl_key.py <key_name>")
|
||||
print("Example: python3 scripts/remove_intl_key.py \"obsoleteKey\"")
|
||||
return 1
|
||||
|
||||
# Get and validate the key name
|
||||
try:
|
||||
key_to_remove = validate_key_name(sys.argv[1])
|
||||
except ValueError as e:
|
||||
print(f"Error: {e}")
|
||||
return 1
|
||||
|
||||
# Get repository root
|
||||
repo_path = Path(__file__).parent.parent.absolute()
|
||||
l10n_dir = repo_path / 'lib' / 'l10n'
|
||||
|
||||
if not l10n_dir.exists():
|
||||
print(f"Error: Could not find l10n directory at {l10n_dir}")
|
||||
return 1
|
||||
|
||||
# Get all .arb files
|
||||
arb_files = sorted(l10n_dir.glob('*.arb'))
|
||||
print(f"Found {len(arb_files)} .arb files to process.")
|
||||
|
||||
if not arb_files:
|
||||
print(f"Error: No .arb files found in {l10n_dir}")
|
||||
return 1
|
||||
|
||||
# Ask for confirmation
|
||||
print(f"\nAbout to remove key '{key_to_remove}' and its metadata '@{key_to_remove}' from all .arb files.")
|
||||
confirm = input("Do you want to continue? (y/N): ").lower().strip()
|
||||
|
||||
if confirm not in ['y', 'yes']:
|
||||
print("Operation cancelled.")
|
||||
return 0
|
||||
|
||||
# Process each .arb file
|
||||
total_removed = 0
|
||||
files_modified = 0
|
||||
print("\nProcessing .arb files...")
|
||||
print("=" * 80)
|
||||
|
||||
for arb_file in arb_files:
|
||||
removed = remove_key_from_arb_file(str(arb_file), key_to_remove)
|
||||
total_removed += removed
|
||||
if removed > 0:
|
||||
files_modified += 1
|
||||
entries = "entry" if removed == 1 else "entries"
|
||||
print(f"{arb_file.name}: Removed {removed} {entries}")
|
||||
else:
|
||||
print(f"{arb_file.name}: Key not found")
|
||||
|
||||
print("=" * 80)
|
||||
print(f"\nSummary:")
|
||||
print(f"Total entries removed: {total_removed}")
|
||||
print(f"Files modified: {files_modified}")
|
||||
print(f"Files processed: {len(arb_files)}")
|
||||
|
||||
if total_removed == 0:
|
||||
print(f"\nWarning: No occurrences of key '{key_to_remove}' were found in any .arb files.")
|
||||
print("Please check that the key name is correct and exists in the files.")
|
||||
else:
|
||||
print(f"\nSuccessfully removed key '{key_to_remove}' from all .arb files.")
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
exit(main())
|
||||
Loading…
Add table
Reference in a new issue