Skip to content

Refactor check spelling script - #1108

Open
Maxcode123 wants to merge 2 commits into
python:3.14from
Maxcode123:refactor-check-spelling-script
Open

Refactor check spelling script#1108
Maxcode123 wants to merge 2 commits into
python:3.14from
Maxcode123:refactor-check-spelling-script

Conversation

@Maxcode123

Copy link
Copy Markdown
Contributor

Τι αλλαγές εισάγει το παρόν PR;

  • Διαμοιράζει την λογική στο script check_spelling.py σε πολλαπλές συναρτήσεις
  • Προσθέτει τρεις επιλογές που μπορούν δοθούν μέσω γραμμής εντολής
  • Αλλάζει την προκαθορισμένη συμπεριφορά του προγραμμάτος (δεν τυπώνονται τα ευρεθέντα σφάλματα). Η προηγούμενη συμπεριφορά αναπαράγεται με την επιλογή -p ή --print-errors: python scripts/check_spelling.py --print-errors
  • Προσαρμόζει το Makefile target spellcheck ώστε να χρησιμοποιεί την παραπάνω επιλογή.

Γιατί χρειάζεται αυτό το PR;

Στον οδηγό συνεισφοράς αναφέρεται το εξής:

Εάν κάποια από τις λέξεις δεν είναι αναγνωρισμένη από το script προσθέστε τη στο dictionary και επαναλάβετε.

Υποβαλλόμενος στην διαδικασία της μετάφρασης του αρχείου library/trace.po έφτασα στο βήμα που περιγράφεται παραπάνω και επειδή βαριόμουν να προσθέσω τις λέξεις μία-μία αποφάσισα να ενισχύσω το υπάρχον script ώστε να αναλάβει αυτό τη δουλειά.
Η προσθήκη νέων λέξεων στο dictionary μπορεί να αυτοματοποιηθεί χρήσει του script:

> python scripts/check_spelling.py --write-entries

Σημειώσεις

Οδηγίες χρήσης script:

> python scripts/check_spelling.py --help
usage: python check_spelling.py [options]

spell-check translated .po files and add new entries to the dictionary if needed.

options:
  -h, --help            show this help message and exit
  -p, --print-errors    print the detected errors of the spell-check
  -w, --write-entries   write the new detected entries in the dictionary file
  -f, --po-files [PO_FILES ...]
                        list of .po files to spell-check, if not given checks all po files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant