Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added template and script to check local files #488

Merged
merged 29 commits into from
Nov 23, 2024
Merged

Conversation

donaldzou
Copy link
Owner

How to use

python3 verify_locale_files.py in src/static/locale

Example

(venv) donaldzou@Mac locale % python3 verify_locale_files.py 
========================================================
| WGDashboard Locale File Verification [by @donaldzou] |
========================================================

Active Languages
        [Language #1] Czech
        [Language #2] German
        [Language #3] English
        [Language #4] Italian
        [Language #5] Dutch
        [Language #6] Russian
        [Language #7] Turkish
        [Language #8] Ukrainian
        [Language #9] Chinese (Simplified)
        [Language #10] Chinese (Traditional)
Select the language number you want to verify or enter [q] to exit: 1

Selected Language: Czech

        [Missing Translations] Simply copy the JSON below into the locale file and translate them in :)
                "Signing In\.\.\.": "",
                "Multi-Factor Authentication \(MFA\)": "",
                "Are you sure to delete this API key\?": "",
                "When should this API Key expire\?": "",
                "Creating\.\.\.": "",
                "Turning On\.\.\.": "",
                "Turning Off\.\.\.": "",
                "Search Peers\.\.\.": "",
                "\(Required for QR Code and Download\)": "",
                "\(Required\)": "",
                "This peer does not have any job yet\.": "",
                "No active job at the moment\.": "",
                "Sharing\.\.\.": "",
                "Stop Sharing\.\.\.": "",
                "Restricting\.\.\.": "",
                "Allowing Access\.\.\.": "",
                "Download \& QR Code is not available due to no private key set for this peer": "",
                "By adding peers by bulk, each peer's name will be auto generated, and Allowed IP will be assign to the next available IP\.": "",
                "How many peers you want to add\?": "",
                "Adding\.\.\.": "",
                "Dashboard IP Address \& Listen Port": ""

        [Deprecated Translations] Simply remove the translation below :)1
                "Signing In...": "Přihlašování..."
                "Multi-Factor Authentication (MFA)": "Vícefaktorové ověření (MFA)"
                "Are you sure to delete this API key?": "Určitě chcete smazat tento API klíč?"
                "When should this API Key expire?": "Kdy má tento API klíč vypršet?"
                "Creating...": "Tvořím..."
                "Turning On...": "Zapínám..."
                "Turning Off...": "Vypínám..."
                "Search Peers...": "Hledat peers..."
                "(Required for QR Code and Download)": "(Nutné pro QR kód a stažení)"
                "(Required)": "(Povinné)"
                "This peer does not have any job yet.": "Tento peer ještě nemá žádný úkol."
                "No active job at the moment.": "Žádný úkol v současnosti neprobíhá."
                "Sharing...": "Sdílím..."
                "Stop Sharing...": "Ukončit sdílení..."
                "Restricting...": "Omezuji..."
                "Allowing Access...": "Povoluji přístup..."
                "Download & QR Code is not available due to no private key set for this peer": "Stažení a QR kód nejsou k dispozici, peer nemá nastavený soukromý klíč."
                "By adding peers by bulk, each peer's name will be auto generated, and Allowed IP will be assign to the next available IP.": "Při hromadném importu bude jméno každého peera vygenerované automaticky, a povolená IP adresa bude nastavena na další v pořadí"
                "How many peers you want to add?": "Kolik peerů chcete přidat?"
                "Adding...": "Přidávám..."

@donaldzou donaldzou requested a review from DaanSelen November 13, 2024 18:03
@donaldzou
Copy link
Owner Author

Hi @DaanSelen, when u are free, do you mind going through this PR and see if there's anything to improve and streamline the localization process?

Thank u!

@DaanSelen
Copy link
Collaborator

I'll go through it, give me some time!

@DaanSelen
Copy link
Collaborator

#492

Copy link
Collaborator

@DaanSelen DaanSelen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple points:
I don't think the PL is alphabetical behind the ZH-HK?
The indentation in pl-pl.json is not consistent. (content looks good)
The Dutch translation changed ... to \\.\\.\\.

src/static/locale/nl-nl.json Outdated Show resolved Hide resolved
src/static/locale/pl.json Outdated Show resolved Hide resolved
src/static/locale/uk.json Show resolved Hide resolved
@donaldzou
Copy link
Owner Author

Yes I found out a bug in the python script that it escaped 2 back slashes when printed out. Need to figure that out :)

@DaanSelen
Copy link
Collaborator

Yes I found out a bug in the python script that it escaped 2 back slashes when printed out. Need to figure that out :)

Did all things get resolved?

@donaldzou
Copy link
Owner Author

Yes I found out a bug in the python script that it escaped 2 back slashes when printed out. Need to figure that out :)

Did all things get resolved?

Yes, now what's left to do is fixing the empty translations that got replaced by the regex escaped keys:

"Sharing..." ==> "Sharing\.\.\."

@donaldzou
Copy link
Owner Author

The current script will insert the new translation and remove deprecated ones directly from the file.

@donaldzou donaldzou merged commit dba55d5 into main Nov 23, 2024
3 checks passed
@donaldzou donaldzou deleted the language-template branch November 23, 2024 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants