Skip to content
Snippets Groups Projects
Commit f2d7369c authored by Neuber, Eugen Ramon's avatar Neuber, Eugen Ramon :speech_balloon: Committed by Reiter, Christoph
Browse files

Use i18next for error message translantion

parent c67c51ca
No related branches found
No related tags found
No related merge requests found
{ {
"error-head": "FEHLER: Information",
"is-forbidden": "ist verboten",
"troubled-server": "macht Probleme am Server",
"unknown-problems": "mit unbekanntem Problem",
"was-not-found": "wurde nicht gefunden"
} }
{ {
"error-head": "ERROR: information",
"is-forbidden": "is forbidden",
"troubled-server": "troubled server",
"unknown-problems": "with unknown problems",
"was-not-found": "was not found"
} }
...@@ -77,23 +77,20 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement { ...@@ -77,23 +77,20 @@ class VPUKnowledgeBaseWebPageElementView extends VPULitElement {
let status_msg; let status_msg;
switch (res.status) { switch (res.status) {
case 403: case 403:
status_msg = that.lang === 'de' ? 'ist verboten' : 'is forbidden'; status_msg = i18n.t('is-forbidden');
break; break;
case 404: case 404:
status_msg = that.lang === 'de' ? 'wurde nicht gefunden' : 'was not found'; status_msg = i18n.t('was-not-found');
break; break;
case 500: case 500:
status_msg = that.lang === 'de' ? 'macht Probleme am Server' : 'troubled server'; status_msg = i18n.t('troubled-server');
break; break;
default: default:
status_msg = that.lang === 'de' ? 'mit unbekanntem Problem' : 'with unknown problems'; status_msg = i18n.t('unknown-problems');
} }
if (that.lang === 'de') { const error_head = i18n.t('error-head');
that.error = html`<p>FEHLER: Information "<b>${that.value}</b>" ${status_msg} (${res.status}).</p>`; that.error = html`<p>${error_head} "<b>${that.value}</b>" ${status_msg} (${res.status}).</p>`;
} else { throw new Error('HTTP ' + error_head + ' ' + that.value + ' ' + status_msg + ', status = ' + res.status);
that.error = html`<p>ERROR: information "<b>${that.value}</b>" ${status_msg} (${res.status}).</p>`;
}
throw new Error('HTTP error: ' +that.value + ' ' + status_msg + ', status = ' + res.status);
} }
return res.json(); return res.json();
}) })
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment