Finalizing the translation system

This commit is contained in:
WolverinDEV 2018-12-15 12:23:23 +01:00
parent 6e82161334
commit 75dd6d716c
21 changed files with 31 additions and 15 deletions

View file

@ -7,8 +7,8 @@
"scripts": {
"compile-sass": "sass --update .:.",
"build-worker": "tsc -p shared/js/workers/tsconfig_worker_codec.json",
"dtsgen": "node build/dtsgen/index.js",
"trgen": "node build/trgen/index.js",
"dtsgen": "node tools/dtsgen/index.js",
"trgen": "node tools/trgen/index.js",
"ttsc": "ttsc"
},
"author": "TeaSpeak (WolverinDEV)",

View file

@ -31,7 +31,7 @@
</div>
<div class="dropdown">
<div class="btn_away_toggle"><div class="icon client-away"></div><a>{{tr "Toggle away status" /}}</a></div>
<div class="btn_away_message"><div class="icon client-away"></div><a>{{ŧr "Set away message" /}}</a></div>
<div class="btn_away_message"><div class="icon client-away"></div><a>{{tr "Set away message" /}}</a></div>
</div>
</div>
<div class="button btn_mute_input">

View file

@ -1,6 +1,6 @@
{
"info": {
"name": "Auto translated messages for language de by the google translator",
"name": "German translation, based on Google Translate",
"contributors": [
{
"name": "Google Translate, via script by Markus Hadenfeldt",
@ -23,9 +23,10 @@
}
},
{
"translated": "Klingt initialisiert",
"translated": "Audios initialisiert",
"flags": [
"google-translate"
"google-translate",
"human-modified"
],
"key": {
"message": "Sounds initialitzed"
@ -2291,9 +2292,10 @@
}
},
{
"translated": "die Einstellungen",
"translated": "Einstellungen",
"flags": [
"google-translate"
"google-translate",
"human-modified"
],
"key": {
"message": "Settings"

View file

@ -1,9 +1,5 @@
{
"translations": [
{
"key": "de_DE",
"path": "de_DE.translation"
},
{
"key": "de_DE_gt",
"path": "de_DE_google_translate.translation"

View file

@ -71,7 +71,7 @@ namespace i18n {
const sloppy = fast_translate[message];
if(sloppy) return sloppy;
console.log("Translating \"%s\". Default: \"%s\"", key, message);
log.info(LogCategory.I18N, "Translating \"%s\". Default: \"%s\"", key, message);
let translated = message;
for(const translation of translations) {
@ -92,7 +92,6 @@ namespace i18n {
async: true,
success: result => {
try {
console.dir(result);
const file = (typeof(result) === "string" ? JSON.parse(result) : result) as TranslationFile;
if(!file) {
reject("Invalid json");
@ -191,6 +190,16 @@ namespace i18n {
for(const repo of config.repositories)
(repo.repository || {load_timestamp: 0}).load_timestamp = 0;
if(config.repositories.length == 0) {
//Add the default TeaSpeak repository
load_repository(settings.static("i18n.default_repository", "i18n/")).then(repo => {
log.info(LogCategory.I18N, tr("Successfully added default repository from \"%s\"."), repo.url);
register_repository(repo);
}).catch(error => {
log.warn(LogCategory.I18N, tr("Failed to add default repository. Error: %o"), error);
});
}
return _cached_repository_config = config;
}
@ -242,7 +251,6 @@ namespace i18n {
export function iterate_translations(callback_entry: (repository: TranslationRepository, entry: TranslationFile) => any, callback_finish: () => any) {
let count = 0;
const update_finish = () => {
console.error(count);
if(count == 0 && callback_finish)
callback_finish();
};

View file

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Translation Manager</title>
</head>
<body>
<div>This needs some improvements</div>
</body>
</html>