mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 15:20:09 +01:00
Added template and script to check local files
This commit is contained in:
parent
27ed0710cc
commit
665b0f1484
312
src/static/locale/language_template.json
Normal file
312
src/static/locale/language_template.json
Normal file
@ -0,0 +1,312 @@
|
|||||||
|
{
|
||||||
|
"Welcome to": "",
|
||||||
|
"Username": "",
|
||||||
|
"Password": "",
|
||||||
|
"OTP from your authenticator": "",
|
||||||
|
"Sign In": "",
|
||||||
|
"Signing In\\.\\.\\.": "",
|
||||||
|
"Access Remote Server": "",
|
||||||
|
"Server": "",
|
||||||
|
"Click": "",
|
||||||
|
"Pinging...": "",
|
||||||
|
"to add your server": "",
|
||||||
|
"Server List": "",
|
||||||
|
"Sorry, your username or password is incorrect.": "",
|
||||||
|
"Home": "",
|
||||||
|
"Settings": "",
|
||||||
|
"Tools": "",
|
||||||
|
"Sign Out": "",
|
||||||
|
"Checking for update...": "",
|
||||||
|
"You're on the latest version": "",
|
||||||
|
"WireGuard Configurations": "",
|
||||||
|
"You don't have any WireGuard configurations yet. Please check the configuration folder or change it in Settings. By default the folder is /etc/wireguard.": "",
|
||||||
|
"Configuration": "",
|
||||||
|
"Configurations": "",
|
||||||
|
"Peers Default Settings": "",
|
||||||
|
"Dashboard Theme": "",
|
||||||
|
"Light": "",
|
||||||
|
"Dark": "",
|
||||||
|
"This will be changed globally, and will be apply to all peer's QR code and configuration file.": "",
|
||||||
|
"WireGuard Configurations Settings": "",
|
||||||
|
"Configurations Directory": "",
|
||||||
|
"Remember to remove / at the end of your path. e.g /etc/wireguard": "",
|
||||||
|
"WGDashboard Account Settings": "",
|
||||||
|
"Current Password": "",
|
||||||
|
"New Password": "",
|
||||||
|
"Repeat New Password": "",
|
||||||
|
"Update Password": "",
|
||||||
|
"Multi-Factor Authentication \\(MFA\\)": "",
|
||||||
|
"Reset": "",
|
||||||
|
"Setup": "",
|
||||||
|
"API Keys": "",
|
||||||
|
"API Key": "",
|
||||||
|
"Key": "",
|
||||||
|
"Enabled": "",
|
||||||
|
"Disabled": "",
|
||||||
|
"No WGDashboard API Key": "",
|
||||||
|
"Expire At": "",
|
||||||
|
"Are you sure to delete this API key\\?": "",
|
||||||
|
"Create API Key": "",
|
||||||
|
"When should this API Key expire\\?": "",
|
||||||
|
"Never Expire": "",
|
||||||
|
"Don't think that's a good idea": "",
|
||||||
|
"Creating\\.\\.\\.": "",
|
||||||
|
"Create": "",
|
||||||
|
"Status": "",
|
||||||
|
"On": "",
|
||||||
|
"Off": "",
|
||||||
|
"Turning On\\.\\.\\.": "",
|
||||||
|
"Turning Off\\.\\.\\.": "",
|
||||||
|
"Address": "",
|
||||||
|
"Listen Port": "",
|
||||||
|
"Public Key": "",
|
||||||
|
"Connected Peers": "",
|
||||||
|
"Total Usage": "",
|
||||||
|
"Total Received": "",
|
||||||
|
"Total Sent": "",
|
||||||
|
"Peers Data Usage": "",
|
||||||
|
"Real Time Received Data Usage": "",
|
||||||
|
"Real Time Sent Data Usage": "",
|
||||||
|
"Peer": "",
|
||||||
|
"Peers": "",
|
||||||
|
"Peer Settings": "",
|
||||||
|
"Download All": "",
|
||||||
|
"Search Peers\\.\\.\\.": "",
|
||||||
|
"Display": "",
|
||||||
|
"Sort By": "",
|
||||||
|
"Refresh Interval": "",
|
||||||
|
"Name": "",
|
||||||
|
"Allowed IPs": "",
|
||||||
|
"Restricted": "",
|
||||||
|
"(.*) Seconds": "",
|
||||||
|
"(.*) Minutes": "",
|
||||||
|
"Configuration Settings": "",
|
||||||
|
"Peer Jobs": "",
|
||||||
|
"Active Jobs": "",
|
||||||
|
"All Active Jobs": "",
|
||||||
|
"Logs": "",
|
||||||
|
"Private Key": "",
|
||||||
|
"\\(Required for QR Code and Download\\)": "",
|
||||||
|
"\\(Required\\)": "",
|
||||||
|
"Endpoint Allowed IPs": "",
|
||||||
|
"DNS": "",
|
||||||
|
"Optional Settings": "",
|
||||||
|
"Pre-Shared Key": "",
|
||||||
|
"MTU": "",
|
||||||
|
"Persistent Keepalive": "",
|
||||||
|
"Reset Data Usage": "",
|
||||||
|
"Total": "",
|
||||||
|
"Sent": "",
|
||||||
|
"Received": "",
|
||||||
|
"Revert": "",
|
||||||
|
"Save Peer": "",
|
||||||
|
"QR Code": "",
|
||||||
|
"Schedule Jobs": "",
|
||||||
|
"Job": "",
|
||||||
|
"Job ID": "",
|
||||||
|
"Unsaved Job": "",
|
||||||
|
"This peer does not have any job yet\\.": "",
|
||||||
|
"if": "",
|
||||||
|
"is": "",
|
||||||
|
"then": "",
|
||||||
|
"larger than": "",
|
||||||
|
"Date": "",
|
||||||
|
"Restrict Peer": "",
|
||||||
|
"Delete Peer": "",
|
||||||
|
"Edit": "",
|
||||||
|
"Delete": "",
|
||||||
|
"Deleting...": "",
|
||||||
|
"Cancel": "",
|
||||||
|
"Save": "",
|
||||||
|
"No active job at the moment\\.": "",
|
||||||
|
"Jobs Logs": "",
|
||||||
|
"Updated at": "",
|
||||||
|
"Refresh": "",
|
||||||
|
"Filter": "",
|
||||||
|
"Success": "",
|
||||||
|
"Failed": "",
|
||||||
|
"Log ID": "",
|
||||||
|
"Message": "",
|
||||||
|
"Share Peer": "",
|
||||||
|
"Currently the peer is not sharing": "",
|
||||||
|
"Sharing\\.\\.\\.": "",
|
||||||
|
"Start Sharing": "",
|
||||||
|
"Stop Sharing\\.\\.\\.": "",
|
||||||
|
"Stop Sharing": "",
|
||||||
|
"Access Restricted": "",
|
||||||
|
"Restrict Access": "",
|
||||||
|
"Restricting\\.\\.\\.": "",
|
||||||
|
"Allow Access": "",
|
||||||
|
"Allowing Access\\.\\.\\.": "",
|
||||||
|
"Download \\& QR Code is not available due to no private key set for this peer": "",
|
||||||
|
"Add Peers": "",
|
||||||
|
"Bulk Add": "",
|
||||||
|
"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\\?": "",
|
||||||
|
"You can add up to (.*) peers": "",
|
||||||
|
"Use your own Private and Public Key": "",
|
||||||
|
"Enter IP Address/CIDR": "",
|
||||||
|
"IP Address/CIDR": "",
|
||||||
|
"or": "",
|
||||||
|
"Pick Available IP": "",
|
||||||
|
"No available IP containing": "",
|
||||||
|
"Add": "",
|
||||||
|
"Adding\\.\\.\\.": "",
|
||||||
|
"Failed to check available update": "",
|
||||||
|
"Nice to meet you!": "",
|
||||||
|
"Please fill in the following fields to finish setup": "",
|
||||||
|
"Create an account": "",
|
||||||
|
"Enter an username you like": "",
|
||||||
|
"Enter a password": "",
|
||||||
|
"\\(At least 8 characters and make sure is strong enough!\\)": "",
|
||||||
|
"Confirm password": "",
|
||||||
|
"Next": "",
|
||||||
|
"Saving\\.\\.\\.": "",
|
||||||
|
"1\\. Please scan the following QR Code to generate TOTP with your choice of authenticator": "",
|
||||||
|
"Or you can click the link below:": "",
|
||||||
|
"2\\. Enter the TOTP generated by your authenticator to verify": "",
|
||||||
|
"TOTP verified!": "",
|
||||||
|
"I don't need MFA": "",
|
||||||
|
"Complete": "",
|
||||||
|
"(v[0-9.]{1,}) is now available for update!": "",
|
||||||
|
"Current Version:": "",
|
||||||
|
"Oh no\\.\\.\\. This link is either expired or invalid\\.": "",
|
||||||
|
"Scan QR Code with the WireGuard App to add peer": "",
|
||||||
|
"or click the button below to download the ": "",
|
||||||
|
" file": "",
|
||||||
|
"FROM ": "",
|
||||||
|
"(.*) is on": "",
|
||||||
|
"(.*) is off": "",
|
||||||
|
"Allowed IPs is invalid": "",
|
||||||
|
"Peer created successfully": "",
|
||||||
|
"Please fill in all required box": "",
|
||||||
|
"Please specify amount of peers you want to add": "",
|
||||||
|
"No more available IP can assign": "",
|
||||||
|
"The maximum number of peers can add is (.*)": "",
|
||||||
|
"Generating key pairs by bulk failed": "",
|
||||||
|
"Failed to add peers in bulk": "",
|
||||||
|
"This peer already exist": "",
|
||||||
|
"This IP is not available: (.*)": "",
|
||||||
|
"Configuration does not exist": "",
|
||||||
|
"Peer does not exist": "",
|
||||||
|
"Please provide a valid configuration name": "",
|
||||||
|
"Peer saved": "",
|
||||||
|
"Allowed IPs already taken by another peer": "",
|
||||||
|
"Endpoint Allowed IPs format is incorrect": "",
|
||||||
|
"DNS format is incorrect": "",
|
||||||
|
"MTU format is not correct": "",
|
||||||
|
"Persistent Keepalive format is not correct": "",
|
||||||
|
"Private key does not match with the public key": "",
|
||||||
|
"Update peer failed when updating Pre-Shared Key": "",
|
||||||
|
"Update peer failed when updating Allowed IPs": "",
|
||||||
|
"Update peer failed when saving the configuration": "",
|
||||||
|
"Peer data usage reset successfully": "",
|
||||||
|
"Peer download started": "",
|
||||||
|
"Please specify one or more peers": "",
|
||||||
|
"Share link failed to create. Reason: (.*)": "",
|
||||||
|
"Link expire date updated": "",
|
||||||
|
"Link expire date failed to update. Reason: (.*)": "",
|
||||||
|
"Peer job saved": "",
|
||||||
|
"Please specify job": "",
|
||||||
|
"Please specify peer and configuration": "",
|
||||||
|
"Peer job deleted": "",
|
||||||
|
"API Keys function is successfully enabled": "",
|
||||||
|
"API Keys function is successfully disabled": "",
|
||||||
|
"API Keys function is failed to enable": "",
|
||||||
|
"API Keys function is failed to disable": "",
|
||||||
|
"WGDashboard API Keys function is disabled": "",
|
||||||
|
"WireGuard configuration path saved": "",
|
||||||
|
"API Key deleted": "",
|
||||||
|
"API Key created": "",
|
||||||
|
"Sign in session ended, please sign in again": "",
|
||||||
|
"Please specify an IP Address (v4/v6)": "",
|
||||||
|
"Please provide ipAddress and count": "",
|
||||||
|
"Please provide ipAddress": "",
|
||||||
|
"Dashboard Language": "",
|
||||||
|
"Dashboard language update failed": "",
|
||||||
|
"Peer Remote Endpoint": "",
|
||||||
|
"New Configuration": "",
|
||||||
|
"Configuration Name": "",
|
||||||
|
"Configuration name is invalid. Possible reasons:": "",
|
||||||
|
"Configuration name already exist\\.": "",
|
||||||
|
"Configuration name can only contain 15 lower/uppercase alphabet, numbers, underscore, equal sign, plus sign, period and hyphen\\.": "",
|
||||||
|
"Invalid Port": "",
|
||||||
|
"Save Configuration": "",
|
||||||
|
"IP Address/CIDR is invalid": "",
|
||||||
|
"IP Address": "",
|
||||||
|
"Enter IP Address / Hostname": "",
|
||||||
|
"IP Address / Hostname": "",
|
||||||
|
"Dashboard IP Address \\& Listen Port": "",
|
||||||
|
"Count": "",
|
||||||
|
"Geolocation": "",
|
||||||
|
"Is Alive": "",
|
||||||
|
"Average / Min / Max Round Trip Time": "",
|
||||||
|
"Sent / Received / Lost Package": "",
|
||||||
|
"Manual restart of WGDashboard is needed to apply changes on IP Address and Listen Port": "",
|
||||||
|
"Restore Configuration": "",
|
||||||
|
"Step (.*)": "",
|
||||||
|
"Select a backup you want to restore": "",
|
||||||
|
"Click to change a backup": "",
|
||||||
|
"Selected Backup": "",
|
||||||
|
"You don't have any configuration to restore": "",
|
||||||
|
"Help": "",
|
||||||
|
"Backup": "",
|
||||||
|
"([0-9].*) Backups?": "",
|
||||||
|
"Yes": "",
|
||||||
|
"No": "",
|
||||||
|
"Backup not selected": "",
|
||||||
|
"Confirm \\& edit restore information": "",
|
||||||
|
"(.*) Available IP Address": "",
|
||||||
|
"Database File": "",
|
||||||
|
"Contain": "",
|
||||||
|
"Restricted Peers?": "",
|
||||||
|
"Restore": "",
|
||||||
|
"Restoring": "",
|
||||||
|
"WGDashboard Settings": "",
|
||||||
|
"Peers Settings": "",
|
||||||
|
"WireGuard Configuration Settings": "",
|
||||||
|
"Appearance": "",
|
||||||
|
"Theme": "",
|
||||||
|
"Language": "",
|
||||||
|
"Account Settings": "",
|
||||||
|
"Peer Default Settings": "",
|
||||||
|
"Toggle When Start Up": "",
|
||||||
|
"Other Settings": "",
|
||||||
|
"Select Peers": "",
|
||||||
|
"Backup & Restore": "",
|
||||||
|
"Delete Configuration": "",
|
||||||
|
"Create Backup": "",
|
||||||
|
"No backup yet, click the button above to create backup\\.": "",
|
||||||
|
"Are you sure to delete this backup\\?": "",
|
||||||
|
"Are you sure to restore this backup?\\": "",
|
||||||
|
"Backup Date": "",
|
||||||
|
"File": "",
|
||||||
|
"Are you sure to delete this configuration\\?": "",
|
||||||
|
"Once you deleted this configuration\\:": "",
|
||||||
|
"All connected peers will get disconnected": "",
|
||||||
|
"Both configuration file \\(\\.conf\\) and database table related to this configuration will get deleted": "",
|
||||||
|
"Checking backups...": "",
|
||||||
|
"This configuration have ([0-9].*) backups": "",
|
||||||
|
"This configuration have no backup": "",
|
||||||
|
"If you're sure, please type in the configuration name below and click Delete": "",
|
||||||
|
"Select All": "",
|
||||||
|
"Clear Selection": "",
|
||||||
|
"([0-9].*) Peers?": "",
|
||||||
|
"Downloading": "",
|
||||||
|
"Download Finished": "",
|
||||||
|
"Done": "",
|
||||||
|
"Are you sure to delete": "",
|
||||||
|
"Are you sure to delete this peer\\?": "",
|
||||||
|
"Configuration deleted": "",
|
||||||
|
"Configuration saved": "",
|
||||||
|
"WGDashboard language update failed": "",
|
||||||
|
"Configuration restored": "",
|
||||||
|
"Allowed IP already taken by another peer": "",
|
||||||
|
"Failed to allow access of peer (.*)": "",
|
||||||
|
"Failed to save configuration through WireGuard": "",
|
||||||
|
"Allow access successfully": "",
|
||||||
|
"Deleted ([0-9]{1,}) peer\\(s\\)": "",
|
||||||
|
"Deleted ([0-9]{1,}) peer\\(s\\) successfully. Failed to delete ([0-9]{1,}) peer\\(s\\)": "",
|
||||||
|
"Restricted ([0-9]{1,}) peer\\(s\\)": "",
|
||||||
|
"Restricted ([0-9]{1,}) peer\\(s\\) successfully. Failed to restrict ([0-9]{1,}) peer\\(s\\)": ""
|
||||||
|
}
|
65
src/static/locale/verify_locale_files.py
Normal file
65
src/static/locale/verify_locale_files.py
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
import json
|
||||||
|
import os.path
|
||||||
|
|
||||||
|
from typing_extensions import deprecated
|
||||||
|
|
||||||
|
active_languages = json.loads(open("active_languages.json", "r").read())
|
||||||
|
language_template = json.loads(open("language_template.json", "r").read())
|
||||||
|
welcome = "WGDashboard Locale File Verification [by @donaldzou]"
|
||||||
|
|
||||||
|
print("="*(len(welcome) + 4))
|
||||||
|
print(f"| {welcome} |")
|
||||||
|
print("="*(len(welcome) + 4))
|
||||||
|
print()
|
||||||
|
print("Active Languages")
|
||||||
|
|
||||||
|
for al in range(len(active_languages)):
|
||||||
|
print(f"\t[Language #{al + 1}] {active_languages[al]['lang_name']}")
|
||||||
|
|
||||||
|
k = -1
|
||||||
|
|
||||||
|
m = input("Select the language number you want to verify or enter [q] to exit: ")
|
||||||
|
if m != "q":
|
||||||
|
if m.isdigit():
|
||||||
|
k = int(m) - 1
|
||||||
|
if k < 0 or k > len(active_languages):
|
||||||
|
exit(0)
|
||||||
|
else:
|
||||||
|
exit(0)
|
||||||
|
else:
|
||||||
|
exit(0)
|
||||||
|
|
||||||
|
|
||||||
|
print()
|
||||||
|
print(f"Selected Language: {active_languages[k]['lang_name']}")
|
||||||
|
if active_languages[k]['lang_id'] != "en":
|
||||||
|
with open(f"{active_languages[k]['lang_id']}.json", "r") as f:
|
||||||
|
|
||||||
|
lang_file = json.loads(f.read())
|
||||||
|
missing_translation = []
|
||||||
|
deprecated_translation = []
|
||||||
|
|
||||||
|
for a in language_template.keys():
|
||||||
|
if a not in lang_file.keys():
|
||||||
|
missing_translation.append(a)
|
||||||
|
|
||||||
|
for b in lang_file.keys():
|
||||||
|
if b not in language_template.keys():
|
||||||
|
deprecated_translation.append(b)
|
||||||
|
|
||||||
|
|
||||||
|
print("\n\t[Missing Translations] Simply copy the JSON below into the locale file and translate them in :)")
|
||||||
|
if len(missing_translation) > 0:
|
||||||
|
for a in range(len(missing_translation)):
|
||||||
|
print(f'\t\t"{missing_translation[a]}": ""{(',' if a < len(missing_translation) - 1 else '')}')
|
||||||
|
else:
|
||||||
|
print("\t\tNo missing translations ;) You're all good!")
|
||||||
|
|
||||||
|
|
||||||
|
print("\n\t[Deprecated Translations] Simply remove the translation below :)1")
|
||||||
|
if len(deprecated_translation) > 0:
|
||||||
|
for a in range(len(deprecated_translation)):
|
||||||
|
print(f'\t\t"{deprecated_translation[a]}": "{lang_file[deprecated_translation[a]]}"')
|
||||||
|
|
||||||
|
else:
|
||||||
|
print("\t\tNo deprecated9 translations ;) You're all good!")
|
Loading…
Reference in New Issue
Block a user