Finalized translation system and added polish and turkish google translation
This commit is contained in:
parent
75dd6d716c
commit
21e6ce7582
10 changed files with 14711 additions and 1843 deletions
|
@ -1,26 +1,33 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function execute_tsc() {
|
||||
if [ "$command_tsc" == "" ]; then
|
||||
if [ "$node_bin" == "" ]; then
|
||||
node_bin=$(npm bin)
|
||||
fi
|
||||
execute_npm_command tsc $@
|
||||
}
|
||||
|
||||
if [ ! -e "${node_bin}/tsc" ]; then
|
||||
echo "Could not find tsc command"
|
||||
function execute_ttsc() {
|
||||
execute_npm_command ttsc $@
|
||||
}
|
||||
|
||||
function execute_npm_command() {
|
||||
command_name=$1
|
||||
command_variable="command_$command_name"
|
||||
#echo "Variable names $command_variable"
|
||||
|
||||
if [ "${!command_variable}" == "" ]; then
|
||||
node_bin=$(npm bin)
|
||||
#echo "Node root ${node_bin}"
|
||||
|
||||
if [ ! -e "${node_bin}/${command_name}" ]; then
|
||||
echo "Could not find \"$command_name\" command"
|
||||
echo "May type npm install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
command_tsc="${node_bin}/tsc"
|
||||
|
||||
output=$(${command_tsc} -v)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to execute a simple tsc command!"
|
||||
echo "$output"
|
||||
exit 1
|
||||
fi
|
||||
eval "${command_variable}=\"${node_bin}/${command_name}\""
|
||||
fi
|
||||
|
||||
${command_tsc} $@
|
||||
echo "Arguments: ${@:2}"
|
||||
${!command_variable} ${@:2}
|
||||
}
|
||||
|
||||
execute_npm_command $@
|
|
@ -60,14 +60,14 @@ if [ "$type" == "release" ]; then #Compile everything for release mode
|
|||
fi
|
||||
elif [ "$type" == "development" ]; then
|
||||
echo "Building shared source"
|
||||
execute_tsc -p ./shared/tsconfig/tsconfig.json
|
||||
execute_ttsc -p ./shared/tsconfig/tsconfig.json
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to compile shared sources"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Building web client source"
|
||||
execute_tsc -p ./web/tsconfig/tsconfig.json
|
||||
execute_ttsc -p ./web/tsconfig/tsconfig.json
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to compile web sources"
|
||||
exit 1
|
||||
|
|
25
shared/generate_i18n_gtranslate.py
Normal file → Executable file
25
shared/generate_i18n_gtranslate.py
Normal file → Executable file
|
@ -1,8 +1,11 @@
|
|||
#!/usr/bin/env python2.7
|
||||
|
||||
"""
|
||||
We want python 2.7 again...
|
||||
"""
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
"""
|
||||
from googletrans import Translator # Use the free webhook
|
||||
|
@ -46,7 +49,10 @@ def translate_messages(source, destination, target_language):
|
|||
with open(source) as f:
|
||||
data = json.load(f)
|
||||
|
||||
result = {}
|
||||
result = {
|
||||
"translations": [],
|
||||
"info": None
|
||||
}
|
||||
try:
|
||||
with open(destination) as f:
|
||||
result = json.load(f)
|
||||
|
@ -60,7 +66,6 @@ def translate_messages(source, destination, target_language):
|
|||
translations = []
|
||||
else:
|
||||
print("Loaded {} old translations".format(len(translations)))
|
||||
# TODO translate
|
||||
|
||||
messages = []
|
||||
for message in data:
|
||||
|
@ -112,12 +117,18 @@ def translate_messages(source, destination, target_language):
|
|||
print("Done")
|
||||
|
||||
|
||||
def main():
|
||||
#print(run_translate(["Hello World", "Bla bla bla", "Im a unicorn"], "en", "de"))
|
||||
translate_messages("generated/messages_script.json", "test.json", "de")
|
||||
translate_messages("generated/messages_template.json", "test.json", "de")
|
||||
def main(target_language):
|
||||
target_file = "i18n/{}_google_translate.translation".format(target_language)
|
||||
|
||||
translate_messages("generated/messages_script.json", target_file, target_language)
|
||||
translate_messages("generated/messages_template.json", target_file, target_language)
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
if len(sys.argv) != 2:
|
||||
print("Invalid argument count!")
|
||||
print("Usage: ./generate_i18n_gtranslate.py <language>")
|
||||
exit(1)
|
||||
|
||||
main(sys.argv[1])
|
||||
|
|
|
@ -19,7 +19,7 @@ if [ ! -e ${LOADER_FILE} ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
execute_tsc -p tsconfig/tsconfig_packed.json
|
||||
execute_ttsc -p tsconfig/tsconfig_packed.json
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Failed to generate packed file!"
|
||||
exit 1
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,16 @@
|
|||
{
|
||||
"translations": [
|
||||
{
|
||||
"key": "de_DE_gt",
|
||||
"path": "de_DE_google_translate.translation"
|
||||
"key": "de_gt",
|
||||
"path": "de_google_translate.translation"
|
||||
},
|
||||
{
|
||||
"key": "pl_gt",
|
||||
"path": "pl_google_translate.translation"
|
||||
},
|
||||
{
|
||||
"key": "tr_gt",
|
||||
"path": "tr_google_translate.translation"
|
||||
}
|
||||
],
|
||||
"name": "Default TeaSpeak repository",
|
||||
|
|
5728
shared/i18n/pl_google_translate.translation
Normal file
5728
shared/i18n/pl_google_translate.translation
Normal file
File diff suppressed because it is too large
Load diff
5728
shared/i18n/tr_google_translate.translation
Normal file
5728
shared/i18n/tr_google_translate.translation
Normal file
File diff suppressed because it is too large
Load diff
|
@ -99,6 +99,14 @@ async function initialize() {
|
|||
displayCriticalError(message);
|
||||
};
|
||||
|
||||
try {
|
||||
await i18n.initialize();
|
||||
} catch(error) {
|
||||
console.error(tr("Failed to initialized the translation system!\nError: %o"), error);
|
||||
displayCriticalError("Failed to setup the translation system");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if(!setup_jsrender())
|
||||
throw "invalid load";
|
||||
|
@ -116,14 +124,6 @@ async function initialize() {
|
|||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await i18n.initialize();
|
||||
} catch(error) {
|
||||
console.error(tr("Failed to initialized the translation system!\nError: %o"), error);
|
||||
displayCriticalError("Failed to setup the translation system");
|
||||
return;
|
||||
}
|
||||
|
||||
AudioController.initializeAudioController();
|
||||
if(!TSIdentityHelper.setup()) {
|
||||
console.error(tr("Could not setup the TeamSpeak identity parser!"));
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"sourceMap": true,
|
||||
"plugins": [ /* ttypescript */
|
||||
{
|
||||
"transform": "../../build/trgen/ttsc_transformer.js",
|
||||
"transform": "../../tools/trgen/ttsc_transformer.js",
|
||||
"type": "program",
|
||||
"target_file": "../generated/messages_script.json",
|
||||
"verbose": true
|
||||
|
|
Loading…
Add table
Reference in a new issue