Stirling-PDF/scripts
Ludy ef07a6134a
feat(scripts): enhance translation progress tool with CLI flags, TOML management, and CI-friendly output (#4801)
# Description of Changes

- **What was changed**
- Refactored `scripts/counter_translation.py` into a more modular CLI
tool.
  - Added argument parsing with new flags:
    - `--lang/-l` to check a single `messages_*.properties` file.
- `--show-percentage/-sp` to print **only** the numeric percentage
(useful for CI).
- `--show-missing-keys/-smk` to list untranslated keys for a single
language.
- Introduced `main()` entrypoint and helper `_lang_from_path()` for
robust language code extraction.
  - Improved comparison logic:
    - Skips header lines, trims values, and tolerates BOM.
    - Treats `en_GB`/`en_US` as 100% translated.
- Tracks and reports missing keys; removes keys from ignore list once
translated.
  - Hardened TOML handling:
- Automatically creates/updates `scripts/ignore_translation.toml` when
absent.
    - `convert_to_multiline()` normalizes/sorts arrays for stable diffs.
  - README integration:
    - `write_readme()` updates language badges from computed progress.
- Added type hints, richer docstrings, usage examples, and clearer
console messages.
  - Deduplicates language results and sorts by percentage (desc).
  - Uses consistent UTF-8 and newline handling.

- **Why the change was made**
- Make translation tracking **automation-ready** (CI pipelines can
consume a single number).
- Reduce manual maintenance of ignore lists and improve
**deterministic** formatting for clean diffs.
- Provide better **developer UX** with explicit flags and actionable
diagnostics (missing keys).
- Increase correctness and maintainability via structured code, typing,
and clear responsibilities.


---

## Checklist

### General

- [x] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [x] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md)
(if applicable)
- [x] I have performed a self-review of my own code
- [x] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/devGuide/DeveloperGuide.md#6-testing)
for more details.
2025-11-02 16:34:22 +00:00
..
counter_translation.py feat(scripts): enhance translation progress tool with CLI flags, TOML management, and CI-friendly output (#4801) 2025-11-02 16:34:22 +00:00
download-security-jar.sh Fix for security not downloading and running correctly in V1.0.0 (#3902) 2025-07-07 23:54:58 +01:00
generate_requirements.bat fix(ci): 🛡️mitigate CVE-2025-8869 by pinning pip to patched commit and upgrading dev dependency pins (#4630) 2025-10-16 22:40:14 +01:00
ignore_translation.toml feat(i18n): add German translations (#4796) 2025-11-02 16:06:48 +00:00
init-without-ocr.sh refactor: move modules under app/ directory and update file paths (#3938) 2025-07-14 20:53:11 +01:00
init.sh refactor: move modules under app/ directory and update file paths (#3938) 2025-07-14 20:53:11 +01:00
installFonts.sh print (WIP), fake scan (WIP) and text conversion for ultra-lite (#1098) 2024-04-21 23:06:44 +01:00
PropSync.java refactor: move modules under app/ directory and update file paths (#3938) 2025-07-14 20:53:11 +01:00
remove_translation_keys.sh refactor: move modules under app/ directory and update file paths (#3938) 2025-07-14 20:53:11 +01:00
replace_translation_line.sh refactor: move modules under app/ directory and update file paths (#3938) 2025-07-14 20:53:11 +01:00