feat(i18n): add English, Spanish and Galician translations for error messages
This commit is contained in:
parent
fff9362ea8
commit
54798b7554
@ -0,0 +1,25 @@
|
|||||||
|
package com.pablotj.restemailbridge.infrastructure.config;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.servlet.LocaleResolver;
|
||||||
|
import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class LocaleConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public LocaleResolver localeResolver() {
|
||||||
|
AcceptHeaderLocaleResolver resolver = new AcceptHeaderLocaleResolver();
|
||||||
|
resolver.setDefaultLocale(Locale.of("en"));
|
||||||
|
resolver.setSupportedLocales(
|
||||||
|
List.of(Locale.of("es"),
|
||||||
|
Locale.of("en"),
|
||||||
|
Locale.of("gl"))
|
||||||
|
);
|
||||||
|
return resolver;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.pablotj.restemailbridge.infrastructure.config;
|
||||||
|
|
||||||
|
import org.springframework.context.MessageSource;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.support.ResourceBundleMessageSource;
|
||||||
|
import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class MessageConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public MessageSource messageSource() {
|
||||||
|
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
|
||||||
|
messageSource.setBasename("i18n/messages");
|
||||||
|
messageSource.setDefaultEncoding("UTF-8");
|
||||||
|
messageSource.setUseCodeAsDefaultMessage(false);
|
||||||
|
return messageSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public LocalValidatorFactoryBean validator(MessageSource messageSource) {
|
||||||
|
LocalValidatorFactoryBean bean = new LocalValidatorFactoryBean();
|
||||||
|
bean.setValidationMessageSource(messageSource);
|
||||||
|
return bean;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
email.from.invalid=Sender email must be valid
|
||||||
|
email.from.blank=Sender email cannot be blank
|
||||||
|
email.from.length=Sender email must be between 4 and 100 characters
|
||||||
|
|
||||||
|
email.subject.blank=Subject cannot be blank
|
||||||
|
email.subject.length=Subject must be between 1 and 30 characters
|
||||||
|
|
||||||
|
email.body.blank=Body cannot be blank
|
||||||
|
email.body.length=Body must be between 1 and 4000 characters
|
@ -0,0 +1,9 @@
|
|||||||
|
email.from.invalid=El remitente debe ser un correo válido
|
||||||
|
email.from.blank=El remitente no puede estar vacío
|
||||||
|
email.from.length=El remitente debe tener entre 4 y 100 caracteres
|
||||||
|
|
||||||
|
email.subject.blank=El asunto no puede estar vacío
|
||||||
|
email.subject.length=El asunto debe tener entre 1 y 30 caracteres
|
||||||
|
|
||||||
|
email.body.blank=El cuerpo no puede estar vacío
|
||||||
|
email.body.length=El cuerpo debe tener entre 1 y 4000 caracteres
|
@ -0,0 +1,9 @@
|
|||||||
|
email.from.invalid=O remitente debe ser un correo válido
|
||||||
|
email.from.blank=O remitente non pode estar baleiro
|
||||||
|
email.from.length=O remitente debe ter entre 4 e 100 caracteres
|
||||||
|
|
||||||
|
email.subject.blank=O asunto non pode estar baleiro
|
||||||
|
email.subject.length=O asunto debe ter entre 1 e 30 caracteres
|
||||||
|
|
||||||
|
email.body.blank=O corpo non pode estar baleiro
|
||||||
|
email.body.length=O corpo debe ter entre 1 e 4000 caracteres
|
Loading…
x
Reference in New Issue
Block a user