working on backend-side translations
This commit is contained in:
@@ -179,7 +179,7 @@ CREATE TABLE IF NOT EXISTS "companies" (
|
||||
rs.close();
|
||||
return companies;
|
||||
} catch (SQLException e) {
|
||||
throw databaseException(FAILED_TO_LOAD_USER_COMPANIES,userId).causedBy(e);
|
||||
throw databaseException(FAILED_TO_LOAD_ENTITIES_OF_OWNER,"companies","user "+userId).causedBy(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ package de.srsoftware.umbrella.core;
|
||||
|
||||
import static de.srsoftware.tools.Optionals.nullable;
|
||||
import static de.srsoftware.umbrella.core.ModuleRegistry.translator;
|
||||
import static java.lang.System.Logger.Level.DEBUG;
|
||||
import static java.lang.System.Logger.Level.WARNING;
|
||||
import static java.lang.System.Logger.Level.*;
|
||||
import static java.net.HttpURLConnection.*;
|
||||
import static java.text.MessageFormat.format;
|
||||
|
||||
@@ -74,8 +73,13 @@ public abstract class BaseHandler extends PathHandler {
|
||||
}
|
||||
|
||||
public boolean send(HttpExchange ex, UmbrellaException e) throws IOException {
|
||||
var cause = e.getCause();
|
||||
String lang = languages(ex).stream().findFirst().orElse(null);
|
||||
var translatedMessage = translator().translate(lang,e.getMessage());
|
||||
if (cause != null){
|
||||
var msg = "en".equals(lang) ? translatedMessage : translator().translate("en",e.getMessage());
|
||||
LOG.log(ERROR,format(msg,e.fills()),cause);
|
||||
}
|
||||
return sendContent(ex,e.statusCode(),format(translatedMessage,e.fills()));
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ public class Errors {
|
||||
public static final String FAILED_TO_DROP_ENTITY_OF_ENTITY = "failed_to_drop_entity_from_entity";
|
||||
public static final String FAILED_TO_DROP_NOTES = "failed_to_drop_notes";
|
||||
public static final String FAILED_TO_GET_FREE_ID = "failed_to_get_free_id";
|
||||
public static final String FAILED_TO_INSERT_PROJECT = "failed_to_insert_project";
|
||||
public static final String FAILED_TO_LIST_ENTITIES = "failed_to_list_entities";
|
||||
public static final String FAILED_TO_LOAD_CHILD_LOCATIONS = "failed_to_load_child_locations";
|
||||
public static final String FAILED_TO_LOAD_ENTITY_MEMBERS = "failed_to_load_entity_members";
|
||||
@@ -24,7 +23,6 @@ public class Errors {
|
||||
public static final String FAILED_TO_LOAD_CUSTOMER_SETTINGS = "failed_to_load_customer_settings";
|
||||
public static final String FAILED_TO_LOAD_ENTITY = "failed_to_load_entity";
|
||||
public static final String FAILED_TO_LOAD_ENTITY_BY_ID = "failed_to_load_entity_by_id";
|
||||
public static final String FAILED_TO_LOAD_USER_COMPANIES = "failed_to_load_user_companies";
|
||||
public static final String FAILED_TO_LOAD_USER_SETTINGS = "failed_to_load_user_settings";
|
||||
public static final String FAILED_TO_MOVE = "failed_to_move";
|
||||
public static final String FAILED_TO_READ_LAST_DOCID = "failed_to_read_last_docId";
|
||||
|
||||
@@ -234,7 +234,7 @@ CREATE TABLE IF NOT EXISTS {0} (
|
||||
return new Project(id, prj.name(), prj.description(),prj.status(),prj.companyId().orElse(null),prj.showClosed(),prj.members(),prj.allowedStates());
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw databaseException(FAILED_TO_INSERT_PROJECT).causedBy(e);
|
||||
throw databaseException(FAILED_TO_STORE_ENTITY,PROJECT).causedBy(e);
|
||||
}
|
||||
} else { // Update
|
||||
try {
|
||||
|
||||
@@ -95,41 +95,36 @@
|
||||
|
||||
"failed": "fehlgeschlagen",
|
||||
"failed_login_attempts" : "Account nach {attempts} fehlgeschlagenen Logins gesperrt bis {release_time}",
|
||||
"failed_to_add_column": "Failed to add {0} column to {1} table",
|
||||
"failed_to_add_prop_to_item": "Failed to add new property to item {0}",
|
||||
"failed_to_assign_contact_to_user": "Failed to assign contact {0} to user {1]",
|
||||
"failed_to_assign_user_to_company": "Failed to assign user {0} to company {1}",
|
||||
"failed_to_check_entity_available": "Failed to check availability of {0}",
|
||||
"failed_to_check_file_permissions": "Failed to check file permissions!",
|
||||
"failed_to_create_state": "Failed to create custom state!",
|
||||
"failed_to_create_table": "Failed to create table `{0}`",
|
||||
"failed_to_drop_entity": "Failed to remove {0} {1}",
|
||||
"failed_to_drop_entity_from_entity": "Failed to remove {0} {1} from {2} {3}",
|
||||
"failed_to_drop_notes": "Failed to delete notes of ({0} {1})",
|
||||
"failed_to_get_free_id": "Failed to query free ID",
|
||||
"failed_to_insert_project": "Failed to insert project into database",
|
||||
"failed_to_list_entities": "Failed to list {0}",
|
||||
"failed_to_load_child_locations": "Failed to load child locations for {0}",
|
||||
"failed_to_load_companies": "Could not load company {0}",
|
||||
"failed_to_load_entity_members": "Failed to load members of {0} {1}",
|
||||
"failed_to_load_entities_of_owner": "Failed to load {0} of {1}",
|
||||
"failed_to_load_customer_number_settings": "Failed to load customer number settings for company {0}",
|
||||
"failed_to_load_customer_price": "Failed to load customer price (company: {0}, customer: {1}, item: {2})",
|
||||
"failed_to_load_customer_settings": "Failed to load customer settings (company: {0}, document type: {1})",
|
||||
"failed_to_load_entity": "Failed to load {0}",
|
||||
"failed_to_load_entity_by_id": "Failed to load {0} with id = {1}",
|
||||
"failed_to_load_project_members": "Failed to load members of project",
|
||||
"failed_to_load_user_companies": "Failed to load companies for user {0}",
|
||||
"failed_to_load_user_settings": "Failed to load settings for user {0}!",
|
||||
"failed_to_move": "Failed to move {0} to {1}!",
|
||||
"failed_to_read_last_docId": "Failed to read last document id",
|
||||
"failed_to_remove_user_from_company": "Failed to remove user {0} from company {1}",
|
||||
"failed_to_search_db": "Failed to search in {0} database!",
|
||||
"failed_to_store_entity": "Failed to store {0}",
|
||||
"failed_to_switch_positions": "Failed to switch positions {0} and {1} of document {2}",
|
||||
"failed_to_update_column": "Failed to update column {0} → {1} of {2}",
|
||||
"failed_to_update_entity": "Failed to update {0} in database",
|
||||
"failed_to_update_table": "Failed to update {0} table!",
|
||||
"failed_to_add_column": "Hinzufügen von Spalte {0} zu Tabelle {1} fehlgeschlagen",
|
||||
"failed_to_add_prop_to_item": "Hinzufügen der neuen Eigenschaft zu Artikel {0} fehlgeschlagen",
|
||||
"failed_to_assign_contact_to_user": "Zuweisung von Kontakt {0} zu Nutzer {1} fehlgeschlagen",
|
||||
"failed_to_assign_user_to_company": "Zuweisen von Nutzer {0} zu Firma {1} fehlgeschlagen",
|
||||
"failed_to_check_entity_available": "Konnte Verfügbarkeit von {0} nicht prüfen",
|
||||
"failed_to_check_file_permissions": "Überprüfung der Dateiberechtigungen fehlgeschlagen!",
|
||||
"failed_to_create_state": "Anlegen des nutzerdefinierten Status fehlgeschlagen!",
|
||||
"failed_to_create_table": "Anlegen der Tabelle `{0}` fehlgeschlagen",
|
||||
"failed_to_drop_entity": "Löschen von {0} {1} fehlgeschlagen",
|
||||
"failed_to_drop_entity_from_entity": "Konnte {0} {1} nicht von {2} {3} löschen",
|
||||
"failed_to_drop_notes": "Löschen der Notizen von ({0} {1}) fehlgeschlagen",
|
||||
"failed_to_get_free_id": "Abfrage einer freien ID fehlgeschlagen",
|
||||
"failed_to_list_entities": "Auflisten von {0} fehlgeschlagen",
|
||||
"failed_to_load_child_locations": "Konnte Locations unter {0} nicht laden",
|
||||
"failed_to_load_entity_members": "Konnte Mitglieder von {0} {1} nicht laden",
|
||||
"failed_to_load_entities_of_owner": "Konnte {0} von {1} nicht laden",
|
||||
"failed_to_load_customer_number_settings": "Konnte Kundennummer-Einstellungen der Firma {0} nicht laden",
|
||||
"failed_to_load_customer_price": "Konnte Kunden-Preis (Firma: {0}, Kunde: {1}, Artikel: {2}) nicht laden",
|
||||
"failed_to_load_customer_settings": "Konte Kunden-Einstellungen (Firma: {0}, Dokumententyp: {1}) nicht laden",
|
||||
"failed_to_load_entity": "Laden von {0} fehlgeschlagen",
|
||||
"failed_to_load_entity_by_id": "Laden von {0} mit ID = {1} fehlgeschlagen",
|
||||
"failed_to_load_user_settings": "Konnte Einstellungen von Nutzer {0} nicht laden!",
|
||||
"failed_to_move": "Verschieben von {0} nach {1} fehlgeschlagen!",
|
||||
"failed_to_read_last_docId": "Lesen der letzten Dokumenten-ID fehlgeschlagen",
|
||||
"failed_to_search_db": "Suche in {0}-Datenbank fehlgeschlagen!",
|
||||
"failed_to_store_entity": "Speichern von {0} fehlgeschlagen",
|
||||
"failed_to_switch_positions": "Tauschen der Positionen {0} und {1} von Dokument {2} fehlgeschlagen",
|
||||
"failed_to_update_column": "Update von Spalte {0} → {1} der Tabelle {2} fehlgeschlagen",
|
||||
"failed_to_update_entity": "Aktualisieren von {0} in Datenbank fehlgeschlagen",
|
||||
"failed_to_update_table": "Aktualisieren der {0}-Tabelle fehlgeschlagen!",
|
||||
"family_name": "Familenname",
|
||||
"file": "Datei",
|
||||
"files": "Dateien",
|
||||
@@ -185,7 +180,7 @@
|
||||
"message": "Nachricht",
|
||||
"messages": "Benachrichtigungen",
|
||||
"miscellaneous_settings": "sonstige Einstellungen",
|
||||
"missing_new_item_id": "Old item id ({0}) has no new counterpart!",
|
||||
"missing_new_item_id": "Alter Artikel-ID ({0}) wurde keine neue ID zugeordnet!",
|
||||
"mismatch": "ungleich",
|
||||
"model": "Modell",
|
||||
"models": "Modelle",
|
||||
@@ -218,7 +213,7 @@
|
||||
"new_document_from": "{number} / neues {type}s-Dokument von {sender}",
|
||||
"new_password": "neues Passwort",
|
||||
"new_property": "neue Eigenschaft",
|
||||
"no_bookmark_for_urlid": "No bookmark with urlId {0}",
|
||||
"no_bookmark_for_urlid": "Kein Lesezeichen zur URL-ID {0}",
|
||||
"no_company": "keine Firma",
|
||||
"no_project_for_id": "Kein Projekt mit ID {0} gefunden!",
|
||||
"no_task_for_id": "Keine Aufgabe mit ID {0} gefunden!",
|
||||
@@ -336,10 +331,10 @@
|
||||
"type_offer": "Angebot",
|
||||
"type_reminder": "Erinnerung",
|
||||
|
||||
"unexpected_item_id_format": "Expected old item ID to be of the form ss:dd:dd, encountered {0}!",
|
||||
"unexpected_item_id_format": "Alte Artikel-ID sollte die Form tt:zz:zz haben, habe aber {0} gefunden!",
|
||||
"unit": "Einheit",
|
||||
"unit_price": "Preis/Einheit",
|
||||
"unknown_item_location": "Item {0} of {1} {2} refers to location {3}, which is unknown!",
|
||||
"unknown_item_location": "Artikel {0} von {1} {2} ist verknüpft mit unbekanntem Lagerort {3}!",
|
||||
"unlink": "Trennen",
|
||||
"update": "aktualisieren",
|
||||
"UPDATE_USERS" : "Nutzer aktualisieren",
|
||||
@@ -363,4 +358,4 @@
|
||||
"year": "Jahr",
|
||||
"your_password_reset_token" : "Ihr Token zum Erstellen eines neuen Passworts",
|
||||
"your_profile": "dein Profil"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,6 +95,36 @@
|
||||
|
||||
"failed": "failed",
|
||||
"failed_login_attempts" : "account locked until {release_time} after {attempts} failed login attempts",
|
||||
"failed_to_add_column": "Failed to add {0} column to {1} table",
|
||||
"failed_to_add_prop_to_item": "Failed to add new property to item {0}",
|
||||
"failed_to_assign_contact_to_user": "Failed to assign contact {0} to user {1}",
|
||||
"failed_to_assign_user_to_company": "Failed to assign user {0} to company {1}",
|
||||
"failed_to_check_entity_available": "Failed to check availability of {0}",
|
||||
"failed_to_check_file_permissions": "Failed to check file permissions!",
|
||||
"failed_to_create_state": "Failed to create custom state!",
|
||||
"failed_to_create_table": "Failed to create table `{0}`",
|
||||
"failed_to_drop_entity": "Failed to remove {0} {1}",
|
||||
"failed_to_drop_entity_from_entity": "Failed to remove {0} {1} from {2} {3}",
|
||||
"failed_to_drop_notes": "Failed to delete notes of ({0} {1})",
|
||||
"failed_to_get_free_id": "Failed to query free ID",
|
||||
"failed_to_list_entities": "Failed to list {0}",
|
||||
"failed_to_load_child_locations": "Failed to load child locations for {0}",
|
||||
"failed_to_load_entity_members": "Failed to load members of {0} {1}",
|
||||
"failed_to_load_entities_of_owner": "Failed to load {0} of {1}",
|
||||
"failed_to_load_customer_number_settings": "Failed to load customer number settings for company {0}",
|
||||
"failed_to_load_customer_price": "Failed to load customer price (company: {0}, customer: {1}, item: {2})",
|
||||
"failed_to_load_customer_settings": "Failed to load customer settings (company: {0}, document type: {1})",
|
||||
"failed_to_load_entity": "Failed to load {0}",
|
||||
"failed_to_load_entity_by_id": "Failed to load {0} with id = {1}",
|
||||
"failed_to_load_user_settings": "Failed to load settings for user {0}!",
|
||||
"failed_to_move": "Failed to move {0} to {1}!",
|
||||
"failed_to_read_last_docId": "Failed to read last document id",
|
||||
"failed_to_search_db": "Failed to search in {0} database!",
|
||||
"failed_to_store_entity": "Failed to store {0}",
|
||||
"failed_to_switch_positions": "Failed to switch positions {0} and {1} of document {2}",
|
||||
"failed_to_update_column": "Failed to update column {0} → {1} of {2}",
|
||||
"failed_to_update_entity": "Failed to update {0} in database",
|
||||
"failed_to_update_table": "Failed to update {0} table!",
|
||||
"family_name": "family name",
|
||||
"file": "file",
|
||||
"files": "files",
|
||||
@@ -150,6 +180,7 @@
|
||||
"message": "message",
|
||||
"messages": "messages",
|
||||
"miscellaneous_settings": "miscellaneous settings",
|
||||
"missing_new_item_id": "Old item id ({0}) has no new counterpart!",
|
||||
"mismatch": "mismatch",
|
||||
"model": "model",
|
||||
"models": "models",
|
||||
@@ -182,6 +213,7 @@
|
||||
"new_document_from": "{number} / new {type} document from {sender}",
|
||||
"new_password": "new password",
|
||||
"new_property": "new property",
|
||||
"no_bookmark_for_urlid": "No bookmark with urlId {0}",
|
||||
"no_company": "no company",
|
||||
"no_project_for_id": "No project found for id {0}",
|
||||
"no_task_for_id": "No task found for id {0}",
|
||||
@@ -299,8 +331,10 @@
|
||||
"type_offer": "offer",
|
||||
"type_reminder": "reminder",
|
||||
|
||||
"unexpected_item_id_format": "Expected old item ID to be of the form ss:dd:dd, encountered {0}!",
|
||||
"unit": "unit",
|
||||
"unit_price": "price/unit",
|
||||
"unknown_item_location": "Item {0} of {1} {2} refers to location {3}, which is unknown!",
|
||||
"unlink": "unlink",
|
||||
"update": "update",
|
||||
"UPDATE_USERS" : "update users",
|
||||
|
||||
Reference in New Issue
Block a user