Skip to content

Commit

Permalink
Config version examples
Browse files Browse the repository at this point in the history
  • Loading branch information
André Laugks committed Sep 18, 2024
1 parent 1aa5e34 commit 6763507
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ The class XliffTranslationMessageSource implements the [MessageSource](https://d
* Default locale is `en`.
* The Xliff files are stored in `src/main/resources/translations`.

#### Version >= 2.0.0

```java
import io.github.alaugks.spring.messagesource.xliff.XliffResourceMessageSource;
import org.springframework.context.MessageSource;
Expand All @@ -53,7 +55,7 @@ import org.springframework.context.annotation.Configuration;
import java.util.Locale;

@Configuration
public class MessageConfig {
public class MessageSourceConfig {

@Bean
public MessageSource messageSource() {
Expand All @@ -68,6 +70,29 @@ public class MessageConfig {
}
```

#### Version <= 1.3.0

```java
import de.alaugks.spring.XliffTranslationMessageSource;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Locale;

@Configuration
public class MessageSourceConfig {

public MessageSource messageSource() {
XliffTranslationMessageSource messageSource = new XliffTranslationMessageSource();
messageSource.setDefaultLocale(Locale.forLanguageTag("en"));
messageSource.setBasenamePattern("translations/*");
return messageSource;
}

}
```

## XLIFF Translation Files

* Translations can be separated into different files (domains). The default domain is `messages`.
Expand Down

0 comments on commit 6763507

Please sign in to comment.