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
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
function execute_tsc() {
|
function execute_tsc() {
|
||||||
if [ "$command_tsc" == "" ]; then
|
execute_npm_command tsc $@
|
||||||
if [ "$node_bin" == "" ]; then
|
}
|
||||||
node_bin=$(npm bin)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${node_bin}/tsc" ]; then
|
function execute_ttsc() {
|
||||||
echo "Could not find tsc command"
|
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"
|
echo "May type npm install"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
command_tsc="${node_bin}/tsc"
|
eval "${command_variable}=\"${node_bin}/${command_name}\""
|
||||||
|
|
||||||
output=$(${command_tsc} -v)
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "Failed to execute a simple tsc command!"
|
|
||||||
echo "$output"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
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
|
fi
|
||||||
elif [ "$type" == "development" ]; then
|
elif [ "$type" == "development" ]; then
|
||||||
echo "Building shared source"
|
echo "Building shared source"
|
||||||
execute_tsc -p ./shared/tsconfig/tsconfig.json
|
execute_ttsc -p ./shared/tsconfig/tsconfig.json
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to compile shared sources"
|
echo "Failed to compile shared sources"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Building web client source"
|
echo "Building web client source"
|
||||||
execute_tsc -p ./web/tsconfig/tsconfig.json
|
execute_ttsc -p ./web/tsconfig/tsconfig.json
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to compile web sources"
|
echo "Failed to compile web sources"
|
||||||
exit 1
|
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...
|
We want python 2.7 again...
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
|
|
||||||
"""
|
"""
|
||||||
from googletrans import Translator # Use the free webhook
|
from googletrans import Translator # Use the free webhook
|
||||||
|
@ -46,7 +49,10 @@ def translate_messages(source, destination, target_language):
|
||||||
with open(source) as f:
|
with open(source) as f:
|
||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
|
||||||
result = {}
|
result = {
|
||||||
|
"translations": [],
|
||||||
|
"info": None
|
||||||
|
}
|
||||||
try:
|
try:
|
||||||
with open(destination) as f:
|
with open(destination) as f:
|
||||||
result = json.load(f)
|
result = json.load(f)
|
||||||
|
@ -60,7 +66,6 @@ def translate_messages(source, destination, target_language):
|
||||||
translations = []
|
translations = []
|
||||||
else:
|
else:
|
||||||
print("Loaded {} old translations".format(len(translations)))
|
print("Loaded {} old translations".format(len(translations)))
|
||||||
# TODO translate
|
|
||||||
|
|
||||||
messages = []
|
messages = []
|
||||||
for message in data:
|
for message in data:
|
||||||
|
@ -112,12 +117,18 @@ def translate_messages(source, destination, target_language):
|
||||||
print("Done")
|
print("Done")
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main(target_language):
|
||||||
#print(run_translate(["Hello World", "Bla bla bla", "Im a unicorn"], "en", "de"))
|
target_file = "i18n/{}_google_translate.translation".format(target_language)
|
||||||
translate_messages("generated/messages_script.json", "test.json", "de")
|
|
||||||
translate_messages("generated/messages_template.json", "test.json", "de")
|
translate_messages("generated/messages_script.json", target_file, target_language)
|
||||||
|
translate_messages("generated/messages_template.json", target_file, target_language)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
execute_tsc -p tsconfig/tsconfig_packed.json
|
execute_ttsc -p tsconfig/tsconfig_packed.json
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Failed to generate packed file!"
|
echo "Failed to generate packed file!"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,16 @@
|
||||||
{
|
{
|
||||||
"translations": [
|
"translations": [
|
||||||
{
|
{
|
||||||
"key": "de_DE_gt",
|
"key": "de_gt",
|
||||||
"path": "de_DE_google_translate.translation"
|
"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",
|
"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);
|
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 {
|
try {
|
||||||
if(!setup_jsrender())
|
if(!setup_jsrender())
|
||||||
throw "invalid load";
|
throw "invalid load";
|
||||||
|
@ -116,14 +124,6 @@ async function initialize() {
|
||||||
return;
|
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();
|
AudioController.initializeAudioController();
|
||||||
if(!TSIdentityHelper.setup()) {
|
if(!TSIdentityHelper.setup()) {
|
||||||
console.error(tr("Could not setup the TeamSpeak identity parser!"));
|
console.error(tr("Could not setup the TeamSpeak identity parser!"));
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"plugins": [ /* ttypescript */
|
"plugins": [ /* ttypescript */
|
||||||
{
|
{
|
||||||
"transform": "../../build/trgen/ttsc_transformer.js",
|
"transform": "../../tools/trgen/ttsc_transformer.js",
|
||||||
"type": "program",
|
"type": "program",
|
||||||
"target_file": "../generated/messages_script.json",
|
"target_file": "../generated/messages_script.json",
|
||||||
"verbose": true
|
"verbose": true
|
||||||
|
|
Loading…
Add table
Reference in a new issue