From d442ef812187deb7417557135c841751f1cce84d Mon Sep 17 00:00:00 2001 From: Cleydyr de Albuquerque Date: Sun, 20 Oct 2024 14:08:28 +0200 Subject: [PATCH] fix: add new missing translation --- .../update/v6_0_0$7_0_1$alpha/Update.java | 166 ++++++++++++------ 1 file changed, 113 insertions(+), 53 deletions(-) diff --git a/src/main/java/biblivre/update/v6_0_0$7_0_1$alpha/Update.java b/src/main/java/biblivre/update/v6_0_0$7_0_1$alpha/Update.java index a804cbb7..998e3d68 100644 --- a/src/main/java/biblivre/update/v6_0_0$7_0_1$alpha/Update.java +++ b/src/main/java/biblivre/update/v6_0_0$7_0_1$alpha/Update.java @@ -7,7 +7,6 @@ import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Collection; -import java.util.Map; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -40,80 +39,141 @@ private void addConfigurations(Connection connection) { } private void addTranslations(Connection connection) throws UpdateException { - for (Map.Entry> entry : ADDITIONAL_TRANSLATIONS.entrySet()) { - for (Map.Entry entry2 : entry.getValue().entrySet()) { - String key = entry.getKey(); - - String language = entry2.getKey(); - - String translation = entry2.getValue(); - - translationBO.addSingleTranslation(language, key, translation); - } + for (TranslationModel entry : ADDITIONAL_TRANSLATIONS) { + translationBO.addSingleTranslation(entry.language(), entry.key(), entry.text()); } } - private final Map> ADDITIONAL_TRANSLATIONS = - Map.of( - "cataloging.reservation.error.limit_exceeded", - Map.of( + record TranslationModel(String key, String language, String text) {} + + Collection ADDITIONAL_TRANSLATIONS = + Set.of( + new TranslationModel( + "cataloging.reservation.error.limit_exceeded", "en-US", - "The selected reader surpassed the limit of authorized loans", + "The selected reader surpassed the limit of authorized loans"), + new TranslationModel( + "cataloging.reservation.error.limit_exceeded", "es", - "El lector seleccionado excedió el límite de reservas permitidas", + "El lector seleccionado excedió el límite de reservas permitidas"), + new TranslationModel( + "cataloging.reservation.error.limit_exceeded", "pt-BR", "O leitor selecionado ultrapassou o limite de reservas permitidas"), - "cataloging.import.error.file_upload_error", - Map.of( + new TranslationModel( + "cataloging.import.error.file_upload_error", "en-US", - "Couldn't upload file. Please contact the administrator to analyze this problem.", + "Couldn't upload file. Please contact the administrator to analyze this problem."), + new TranslationModel( + "cataloging.import.error.file_upload_error", "es", - "No ha sido posible subir el archivo. Por favor, contacta el administrador del sistema para analizar este problema.", + "No ha sido posible subir el archivo. Por favor, contacta el administrador del sistema para analizar este problema."), + new TranslationModel( + "cataloging.import.error.file_upload_error", "pt-BR", "Não foi possível fazer upload do arquivo. Por favor, contacte o administrador do sistema para anlizar este problema."), - "administration.configuration.title.holding.label_print_paragraph_alignment", - Map.of( + new TranslationModel( + "administration.configuration.title.holding.label_print_paragraph_alignment", "pt-BR", - "Alinhamento de parágrafo", + "Alinhamento de parágrafo"), + new TranslationModel( + "administration.configuration.title.holding.label_print_paragraph_alignment", "es", - "Alineación de párrafo", + "Alineación de párrafo"), + new TranslationModel( + "administration.configuration.title.holding.label_print_paragraph_alignment", "en-US", "Paragraph alignment"), - "administration.configuration.description.holding.label_print_paragraph_alignment", - Map.of( + new TranslationModel( + "administration.configuration.description.holding.label_print_paragraph_alignment", "pt-BR", - "Alinhamento de parágrafo que será utilizado em cada etiqueta impressa", + "Alinhamento de parágrafo que será utilizado em cada etiqueta impressa"), + new TranslationModel( + "administration.configuration.description.holding.label_print_paragraph_alignment", "es", - "Alineación de párrafo que va a ser usado en cada etiqueta impresa", + "Alineación de párrafo que va a ser usado en cada etiqueta impresa"), + new TranslationModel( + "administration.configuration.description.holding.label_print_paragraph_alignment", "en-US", "Paragraph alignment which will be used in each printed label"), - "administration.configuration.label_print.ALIGN_CENTER", - Map.of("pt-BR", "Centralizado", "es", "Centrado", "en-US", "Center"), - "administration.configuration.label_print.ALIGN_JUSTIFIED_ALL", - Map.of( - "pt-BR", "Justificado (tudo)", - "es", "Justificado (todo)", - "en-US", "Justified (all)"), - "administration.configuration.label_print.ALIGN_JUSTIFIED", - Map.of( - "pt-BR", "Justificado", - "es", "Justificado", - "en-US", "Justified"), - "administration.configuration.label_print.ALIGN_LEFT", - Map.of( - "pt-BR", "À esquerda", - "es", "A la izquierda", - "en-US", "Left"), - "administration.configuration.label_print.ALIGN_RIGHT", - Map.of("pt-BR", "À direita", "es", "A la derecha", "en-US", "Right"), - "circulation.error.invalid_user_name", - Map.of( + new TranslationModel( + "administration.configuration.label_print.ALIGN_CENTER", "pt-BR", - "Este usuário possui nome com caracteres inválidos (:)", + "Centralizado"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_CENTER", "es", - "Este usuario posee un nombre con caracteres inválidos (:)", + "Centrado"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_CENTER", "en-US", - "This user has a name with invalid characters (:)")); + "Center"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_JUSTIFIED_ALL", + "pt-BR", + "Justificado (tudo)"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_JUSTIFIED_ALL", + "es", + "Justificado (todo)"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_JUSTIFIED_ALL", + "en-US", + "Justified (all)"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_JUSTIFIED", + "pt-BR", + "Justificado"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_JUSTIFIED", + "es", + "Justificado"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_JUSTIFIED", + "en-US", + "Justified"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_LEFT", + "pt-BR", + "À esquerda"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_LEFT", + "es", + "A la izquierda"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_LEFT", "en-US", "Left"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_RIGHT", + "pt-BR", + "À direita"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_RIGHT", + "es", + "A la derecha"), + new TranslationModel( + "administration.configuration.label_print.ALIGN_RIGHT", + "en-US", + "Right"), + new TranslationModel( + "circulation.error.invalid_user_name", + "pt-BR", + "Este usuário possui nome com caracteres inválidos (:)"), + new TranslationModel( + "circulation.error.invalid_user_name", + "es", + "Este usuario posee un nombre con caracteres inválidos (:)"), + new TranslationModel( + "circulation.error.invalid_user_name", + "en-US", + "This user has a name with invalid characters (:)"), + new TranslationModel( + "circulation.users.success.saved", + "pt-BR", + "Usuário salvo com sucesso"), + new TranslationModel( + "circulation.users.success.saved", "es", "Usuario guardado con éxito"), + new TranslationModel( + "circulation.users.success.saved", "en-US", "User saved successfully")); private static final String INSERT_CONFIGURATION_TEMPLATE = """