Skip to content

Commit

Permalink
feat: add language pack
Browse files Browse the repository at this point in the history
  • Loading branch information
ShrBox committed Jan 29, 2024
1 parent aaee95a commit 0cbd439
Show file tree
Hide file tree
Showing 16 changed files with 1,343 additions and 1 deletion.
68 changes: 68 additions & 0 deletions scripts/CrowdinDownloader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import os
from shutil import copy
import sys
from crowdin_api import CrowdinClient
import requests
from zipfile import ZipFile

PROJECT_ID = "644072"
OUTPUT_DIR = "../src/lang/"


class Client(CrowdinClient):
TOKEN = sys.argv[1]


def request(url):
resp = requests.get(url)
if resp.status_code == 200:
return resp.content
else:
print("ERROR: " + str(resp.status_code) + " " + resp.reason)
return None


os.makedirs(OUTPUT_DIR, exist_ok=True)
client = Client()
# download source file
files = client.source_files.list_files(PROJECT_ID)
file_id = files["data"][0]["data"]["id"]
download_info = client.source_files.download_file(file_id, PROJECT_ID)
url = download_info["data"]["url"]
with open(OUTPUT_DIR + "en.json", "wb") as file:
file.write(request(url))
print("Download source finished.")

build = client.translations.build_project_translation({}, PROJECT_ID)["data"]
status = ""
while status != "finished":
info = client.translations.check_project_build_status(build["id"], PROJECT_ID)
status = info["data"]["status"]
if status != "finished":
print("Build progress: {}%".format(info["data"]["progress"]))
download_info = client.translations.download_project_translations(
build["id"], PROJECT_ID
)
url = download_info["data"]["url"]
with open("temp.zip", "wb") as file:
file.write(request(url))
print("Zip file downloaded!")

zip = ZipFile("temp.zip")
os.makedirs("./temp", exist_ok=True)
zip.extractall("./temp")
for f in os.listdir("./temp"):
if os.path.isdir("./temp/" + f):
f1 = f
if f.find("-") != -1:
f1 = f.replace("-", "_")
copy("./temp/" + f + "/locale.json", OUTPUT_DIR + f1 + ".json")
if os.path.exists("./temp/" + f + "/cpp-docs-locale.txt"):
os.remove("./temp/" + f + "/cpp-docs-locale.txt")

os.remove("./temp/" + f + "/locale.json")
os.removedirs("./temp/" + f)

zip.close()
os.remove("temp.zip")
print("Finished!")
91 changes: 91 additions & 0 deletions src/lang/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"base": {
"getDimName": {
"0": "Overworld",
"1": "Nederland",
"2": "Ende",
"unknown": "Sonstige Dimension"
}
},
"llse": {
"init": {
"llMoney": {
"notFound": "LLMoney.dll nicht gefunden, ScriptEngine Economy System funktioniert nicht"
}
},
"api": {
"ll": {
"require": {
"success": " - Plugin muss geladen werden. geladen: ",
"fail": " - Plugin erfordert Laden fehlgeschlagen",
"download": {
"success": " - Erfolgreich heruntergeladen erforderlich! Pfad: ",
"fail": " - Download Plugin erforderlich fehlgeschlagen! Code: "
}
}
}
},
"apiHelp": {
"parseJson": {
"fail": "JSON-Parse-Fehler"
}
},
"loader": {
"loadDepends": {
"success": "Abhängigkeit {} geladen.",
"fail": "Fehler beim Laden der Abhängigkeit {}"
},
"loadMain": {
"start": "Lade {type} Plugins...",
"done": "{count} {type} Plugin(s) geladen.",
"nodejs": {
"installPack": {
"fail": "Installation des Plugin-Pakets {}, bitte überprüfe deine package.json-Datei!",
"start": "Node.js Plugin Pack \"{path}\" gefunden! Versuche es zu installieren..."
},
"ignored": "Keine package.json-Datei im Verzeichnis {path}gefunden, ignoriert."
},
"loadedPlugin": "{type} Plugin <{name}> geladen.",
"installPluginPack": {
"done": "{count} {type} Plugin-Paket(e) installiert."
},
"python": {
"ignored": "Keine pyproject.toml Datei im Verzeichnis {path}gefunden, ignoriert.",
"installPack": {
"start": "Python Plugin Pack \"{path}\"gefunden! Versuche zu installieren...",
"fail": "Fehler beim Installieren des Plugin-Pakets {}, bitte überprüfen Sie die Quelldateien!"
}
}
},
"nodejs": {
"executeNpmInstall": {
"success": "Npm erfolgreich abgeschlossen.",
"start": "Führe \"npm install\" für Plugin {name} aus ...",
"fail": "Fehler aufgetreten. Exit-Code: {code}"
},
"register": {
"fail": "Fehler beim Helfen des Plugins {name} registriert werden!"
}
},
"python": {
"executePipInstall": {
"start": "Führe \"pip install\" für Plugin {name} aus ...",
"success": "Pip erfolgreich abgeschlossen.",
"fail": "Fehler aufgetreten. Exit-Code: {code}"
}
}
}
},
"llseapi": {
"require": {
"fail": "Plugin, das von {0} benötigt wird, wurde nicht gefunden.",
"success": "Plugin mit dem Namen {0} , das von {1} benötigt wird.",
"network": {
"fail": "Fehler beim Herunterladen des Plugins, das von {0}benötigt wird, http-Code: {1}"
},
"download": {
"success": "Plugin herunterladen, das von {0} benötigt wird, Pfad {1}."
}
}
}
}
91 changes: 91 additions & 0 deletions src/lang/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"base": {
"getDimName": {
"0": "Overworld",
"1": "Nether",
"2": "End",
"unknown": "Other dimension"
}
},
"llse": {
"init": {
"llMoney": {
"notFound": "LLMoney.dll not found, ScriptEngine Economy System won't work"
}
},
"api": {
"ll": {
"require": {
"success": " - Plugin require loaded successfully. Loaded: ",
"fail": " - Plugin require load failed",
"download": {
"success": " - Successfully downloaded require! Path: ",
"fail": " - Download plugin require failed! Code: "
}
}
}
},
"apiHelp": {
"parseJson": {
"fail": "JSON parse error"
}
},
"loader": {
"loadDepends": {
"success": "Dependence {} loaded.",
"fail": "Fail to load dependence {}"
},
"loadMain": {
"start": "Loading {type} plugins...",
"done": "{count} {type} plugin(s) loaded.",
"nodejs": {
"installPack": {
"fail": "Failed to install plugin pack {}, please check your package.json file!",
"start": "Found Node.js plugin pack \"{path}\"! Try installing..."
},
"ignored": "No package.json file found in directory {path}, ignored."
},
"loadedPlugin": "{type} plugin <{name}> loaded.",
"installPluginPack": {
"done": "{count} {type} plugin pack(s) installed."
},
"python": {
"ignored": "No pyproject.toml file found in directory {path}, ignored.",
"installPack": {
"start": "Found Python plugin pack \"{path}\"! Try installing...",
"fail": "Failed to install plugin pack {}, please check the source files!"
}
}
},
"nodejs": {
"executeNpmInstall": {
"success": "Npm finished successfully.",
"start": "Executing \"npm install\" for plugin {name}...",
"fail": "Error occurred. Exit code: {code}"
},
"register": {
"fail": "Fail to help plugin {name} get registered!"
}
},
"python": {
"executePipInstall": {
"start": "Executing \"pip install\" for plugin {name}...",
"success": "Pip finished successfully.",
"fail": "Error occurred. Exit code: {code}"
}
}
}
},
"llseapi": {
"require": {
"fail": "Plugin which is required by {0} not found.",
"success": "Plugin named {0} which is required by {1} loaded.",
"network": {
"fail": "Error occurred when download plugin which is required by {0}, http code: {1}"
},
"download": {
"success": "Download plugin which is required by {0} successfully, path {1}."
}
}
}
}
91 changes: 91 additions & 0 deletions src/lang/fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
{
"base": {
"getDimName": {
"0": "Surface",
"1": "Le Nether",
"2": "L'Ender",
"unknown": "Autre dimension"
}
},
"llse": {
"init": {
"llMoney": {
"notFound": "LLMoney.dll introuvable,le système d'économie ScriptEngine ne fonctionnera pas"
}
},
"api": {
"ll": {
"require": {
"success": " - Plugin chargé avec succès par require. Chargé : ",
"fail": " - Échec du chargement du plugin par require",
"download": {
"success": "- Require téléchargé avec succès ! Chemin d'accès :",
"fail": "- Échec du téléchargement de plugin par require ! Code :"
}
}
}
},
"apiHelp": {
"parseJson": {
"fail": "Erreur JSON parse"
}
},
"loader": {
"loadDepends": {
"success": "Dépendance {} chargée.",
"fail": "Échec de chargement de la dépendance {}"
},
"loadMain": {
"start": "Chargement des plugins {type}...",
"done": "{count} plugin(s) {type} chargé(s).",
"nodejs": {
"installPack": {
"fail": "Impossible d'installer le plugin pack {}, veuillez vérifier votre fichier package.json !",
"start": "Pack de plugin Node.js «{path}» trouvé ! Essayez d'installer..."
},
"ignored": "Aucun fichier package.json trouvé dans le répertoire {path}, ignoré."
},
"loadedPlugin": "Plugin {type} <{name}> chargé.",
"installPluginPack": {
"done": "{count} pack(s) de plugins {type} chargé(s)."
},
"python": {
"ignored": "Aucun fichier pyproject.toml trouvé dans le répertoire {path}, ignoré.",
"installPack": {
"start": "Trouvé le pack de plugin Python «{path}» ! Essayez d'installer...",
"fail": "Impossible d'installer le plugin pack {}, veuillez vérifier les fichiers sources !"
}
}
},
"nodejs": {
"executeNpmInstall": {
"success": "NPM fini avec succès.",
"start": "Exécution de \"npm install\" pour le plugin {name}...",
"fail": "Une erreur est survenue. Code de sortie : {code}"
},
"register": {
"fail": "Échec de l'enregistrement du plugin {name} !"
}
},
"python": {
"executePipInstall": {
"start": "Exécution de \"pip install\" pour le plugin {name}...",
"success": "Pip terminé avec succès.",
"fail": "Une erreur est survenue. Code de sortie : {code}"
}
}
}
},
"llseapi": {
"require": {
"fail": "Plugin requis par {0} introuvable.",
"success": "Plugin nommé {0} qui est requis par {1} chargé.",
"network": {
"fail": "Une erreur s'est produite lors du téléchargement du plugin qui est requis par {0}, code http : {1}"
},
"download": {
"success": "Télécharger le plugin qui est requis par {0} avec succès, chemin {1}."
}
}
}
}
Loading

0 comments on commit 0cbd439

Please sign in to comment.