Adding translation by using i18n

This commit is contained in:
Félix Aime
2021-02-08 16:34:32 +01:00
parent b759054908
commit 8b3cc56b08
18 changed files with 456 additions and 467 deletions

View File

@ -1,81 +0,0 @@
{
"home": {
"welcome_msg": "Welcome to TinyCheck.",
"help_msg": "We are going to help you to check your device.",
"start_btn": "Let's start!"
},
"analysis": {
"question": "Do you want to analyze the captured communications?",
"no_btn": "No, just save them",
"yes_btn": "Yes, let's do it",
"please_wait_msg": "Please wait during the analysis...",
"some_time_msg": "Yes, it can take some time..."
},
"capture": {
"intercept_coms_msg": "Intercepting the communications of ",
"stop_btn": "Stop the capture"
},
"generate-ap": {
"network_name": "Network name",
"network_password": "Network password",
"tap_msg": "Tap the white frame to generate a new network.",
"generate_ap_msg": "We generate an ephemeral network for you.",
"error_msg1": "Unfortunately, we got some issues <br />during the AP creation.",
"error_msg2": "Please verify that you've two WiFi interfaces on your device<br /> and try again by restarting it.",
"restart_btn": "Restart the device"
},
"report": {
"show_full_report": "Show the full report",
"start_new_capture": "Start a new capture",
"save_capture": "Save the capture",
"numbers": [
"zero",
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
"ten",
"eleven"
],
"stalkerware_msg": "Your device is compromised by<br />a Stalkerware, please check the report.",
"location_msg": "An application is sharing your<br /> current geolocation with a third party.",
"fine_msg": "Everything looks fine, zero alerts.",
"high_msg": "You have {nb} high alert,<br />your device seems to be compromised.",
"moderate_msg": "You have {nb} moderate alerts,<br />your device might be compromised.",
"low_msg": "You have only {nb} low alerts,<br /> don't hesitate to check them.",
"save_report": "Save the report",
"report_of": "Report of",
"ip_address": "IP address",
"mac_address": "MAC address",
"high": "high",
"moderate": "moderate",
"low": "low"
},
"wifi-select": {
"already_connected_question": "You seem to be already connected to a network.<br />Do you want to use the current connection?",
"no_btn": "No, use another",
"yes_btn": "Yes, use it.",
"wifi_name": "Wi-Fi name",
"refresh_btn": "Refresh networks list",
"not_connected": "You seem to not be connected to Internet.",
"please_config": "Please configure the Wi-Fi connection.",
"lets_do_btn": "Ok, let's do that.",
"wifi_connected": "Wi-Fi connected",
"wifi_not_connected": "Wi-Fi not connected. Please retry.",
"tap_keyboard": "Tap on the virtual keyboard to start",
"wifi_password": "Wi-Fi password",
"connect_to_it": "Connect to it"
},
"save-capture": {
"please_connect": "Please connect a USB key to save your capture.",
"we_are_saving": "We are saving your capture.",
"tap_msg": "You can tap the USB key to start a new capture.",
"capture_download": "The capture download is going to start...",
"start_capture_btn": "Start another capture"
}
}

View File

@ -1,81 +0,0 @@
{
"home": {
"welcome_msg": "Bienvenue sur TinyCheck.",
"help_msg": "Nous allons vous accompagner pour analyser votre appareil.",
"start_btn": "Allons-y !"
},
"analysis": {
"question": "Voulez-vous analyser les communications capturées ?",
"no_btn": "Non, enregistrez-les.",
"yes_btn": "Oui, allons-y !",
"please_wait_msg": "Merci d'attendre pendant l'analyse...",
"some_time_msg": "Oui, cela peut prendre du temps..."
},
"capture": {
"intercept_coms_msg": "Interception des communications de ",
"stop_btn": "Arrêter la capture"
},
"generate-ap": {
"network_name": "Nom du réseau",
"network_password": "Mot de passe du réseau",
"tap_msg": "Appuyez sur le cadre blanc pour générer un nouveau réseau.",
"generate_ap_msg": "Nous générons un réseau Wi-Fi éphémère.",
"error_msg1": "Malheureusement, nous rencontrons des problèmes <br />lors de la création du point d'accès.",
"error_msg2": "Veuillez vérifier que vous disposez de <br /> deux interfaces WiFi sur votre appareil.",
"restart_btn": "Restart the device"
},
"report": {
"show_full_report": "Lire le rapport complet",
"start_new_capture": "Nouvelle capture",
"save_capture": "Sauvegarder",
"numbers": [
"zéro",
"une",
"deux",
"trois",
"quatre",
"cinq",
"six",
"sept",
"huit",
"neuf",
"dix",
"onze"
],
"stalkerware_msg": "Votre smartphone est compromis<br /> par un Stalkerware, lisez le rapport.",
"location_msg": "Une application dévoile votre<br /> géo-localisation actelle.",
"fine_msg": "Tout semble OK, vous avez aucue alerte.",
"high_msg": "Vous avez {nb} alerte(s) élevée(s),<br />votre appareil semble être compromis.",
"moderate_msg": "Vous avez {nb} alerte(s) moyenne(s),<br />votre appareil est peut-être compromis.",
"low_msg": "Vous avez uniquement {nb} alerte(s) basse(s)<br /> n'hésitez pas à les lire.",
"save_report": "Sauvegarder le rapport",
"report_of": "Rapport de",
"ip_address": "Adresse IP :",
"mac_address": "Adresse MAC :",
"high": "elevee",
"moderate": "moyenne",
"low": "base"
},
"wifi-select": {
"already_connected_question": "Vous semblez être connecté à un réseau.<br />Voulez-vous utiliser cette connexion ?",
"no_btn": "Non, une autre",
"yes_btn": "Oui, utilisez celle-là",
"wifi_name": "Nom du réseau",
"refresh_btn": "Rafraichir la liste des réseaux",
"not_connected": "Vous semblez ne pas être connecté à Internet.",
"please_config": "Configurez la connexion Wi-Fi.",
"lets_do_btn": "Oui, allons-y.",
"wifi_connected": "Wi-Fi connecté",
"wifi_not_connected": "Wi-Fi non connecté. Ressayez.",
"tap_keyboard": "Appuez sur cet espace pour écrire",
"wifi_password": "Mot de passe",
"connect_to_it": "Se connecter"
},
"save-capture": {
"please_connect": "Connectez une clé USB pour enregistrer votre capture.",
"we_are_saving": "Nous enregistrons votre capture.",
"tap_msg": "Vous pouvez appuyer sur l'animation pour lancer une nouvelle capture.",
"capture_download": "Le téléchargement de la capture va se lancer...",
"start_capture_btn": "Lancer une nouvelle capture"
}
}

View File

@ -13,8 +13,8 @@ misc_bp = Blueprint("misc", __name__)
@misc_bp.route("/reboot", methods=["GET"])
def api_reboot():
"""
Reboot the device
"""
Reboot the device
"""
if read_config(("frontend", "reboot_option")):
sp.Popen("shutdown -r now", shell=True)
@ -25,8 +25,8 @@ def api_reboot():
@misc_bp.route("/quit", methods=["GET"])
def api_quit():
"""
Quit the interface (Chromium browser)
"""
Quit the interface (Chromium browser)
"""
if read_config(("frontend", "quit_option")):
sp.Popen('pkill -INT -f "chromium-browser"', shell=True)
@ -37,8 +37,8 @@ def api_quit():
@misc_bp.route("/shutdown", methods=["GET"])
def api_shutdown():
"""
Reboot the device
"""
Reboot the device
"""
if read_config(("frontend", "shutdown_option")):
sp.Popen("shutdown -h now", shell=True)
@ -49,8 +49,8 @@ def api_shutdown():
@misc_bp.route("/config", methods=["GET"])
def get_config():
"""
Get configuration keys relative to the GUI
"""
Get configuration keys relative to the GUI
"""
return jsonify({
"virtual_keyboard": read_config(("frontend", "virtual_keyboard")),
@ -60,20 +60,6 @@ def get_config():
"quit_option": read_config(("frontend", "quit_option")),
"shutdown_option": read_config(("frontend", "shutdown_option")),
"reboot_option": read_config(("frontend", "reboot_option")),
"iface_out": read_config(("network", "out"))
"iface_out": read_config(("network", "out")),
"user_lang": read_config(("frontend", "user_lang"))
})
@misc_bp.route("/get-lang", methods=["GET"])
def get_lang():
"""
Get the user lang defined in the config.yaml
and retrieve the interface translation.
"""
lang = read_config(("frontend", "user_lang"))
if re.match("^[a-z]{2,3}$", lang):
with open(os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), "app/assets/lang/{}.json".format(lang)), "r") as f:
return(f.read())
else:
with open(os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), "app/assets/lang/en.json"), "r") as f:
return(f.read())