Skip to content

Commit

Permalink
Add version 1.1.1
Browse files Browse the repository at this point in the history
- Improvement internal code does not exist handling
  • Loading branch information
alaugks committed Aug 3, 2023
1 parent 7080fbf commit 9715d28
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ This package provides a **MessageSource** for using translations from XLIFF file

| Version | Description |
|:--------|:------------------------------------------------------------------------------------------|
| 1.1.1 | [Release notes](https://github.com/alaugks/spring-messagesource-xliff/releases/tag/1.1.1) |
| 1.1.0 | [Release notes](https://github.com/alaugks/spring-messagesource-xliff/releases/tag/1.1.0) |
| 1.0.0 | First public version |


[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=alaugks_spring-xliff-translation&metric=alert_status)](https://sonarcloud.io/summary/overall?id=alaugks_spring-xliff-translation) [![Maven Central](https://img.shields.io/maven-central/v/io.github.alaugks/spring-messagesource-xliff.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/io.github.alaugks/spring-messagesource-xliff/1.1.0)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=alaugks_spring-xliff-translation&metric=alert_status)](https://sonarcloud.io/summary/overall?id=alaugks_spring-xliff-translation) [![Maven Central](https://img.shields.io/maven-central/v/io.github.alaugks/spring-messagesource-xliff.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/io.github.alaugks/spring-messagesource-xliff/1.1.1)


<a name="a2"></a>
Expand All @@ -37,13 +38,13 @@ This package provides a **MessageSource** for using translations from XLIFF file
<dependency>
<groupId>io.github.alaugks</groupId>
<artifactId>spring-messagesource-xliff</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
</dependency>
```

**Gradle**
```text
implementation group: 'io.github.alaugks', name: 'spring-messagesource-xliff', version: '1.1.0'
implementation group: 'io.github.alaugks', name: 'spring-messagesource-xliff', version: '1.1.1'
```


Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>io.github.alaugks</groupId>
<artifactId>spring-messagesource-xliff</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>
<packaging>jar</packaging>

<name>${project.groupId}:${project.artifactId}</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,20 @@ public Translation get(Locale locale, String code) {
String targetValueCode = null;
if (targetValue == null) {
targetValueCode = code;
this.put(locale, this.defaultDomain, code, targetValueCode);
this.put(locale, code, targetValueCode);
}

return new Translation(code, (targetValue != null ? targetValue : targetValueCode));
}

void put(Locale locale, String code, String targetValue) {
this.catalogCache.put(
locale,
code,
targetValue
);
}

void put(Locale locale, String domain, String code, String targetValue) {
this.catalogCache.put(
locale,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ void test_get() {
assertEquals("Hello EN (messages)", this.catalogWrapper.get(this.locale, "messages.hello_language").toString());
}

@Test
void test_get_notExists() {
for (int i = 0; i < 3; i++) {
assertEquals("not-exists-id", this.catalogWrapper.get(this.locale, "not-exists-id").toString());
}
}

@Test
void test_put() {
this.catalogWrapper.setDefaultDomain("foo");
Expand Down Expand Up @@ -157,7 +164,6 @@ void test_fillCacheWithCodeBecauseCodeNotExists() {
// code add cache
orderVerifier.verify(mockedCatalogWrapper).put(
this.locale,
"messages",
"messages.hello_language_not_exists",
"messages.hello_language_not_exists"
);
Expand All @@ -166,7 +172,6 @@ void test_fillCacheWithCodeBecauseCodeNotExists() {
verify(mockedXliffCatalogBuilder, times(2)).createCatalog(resourcesLoader, catalog);
verify(mockedCatalogWrapper, times(1)).put(
this.locale,
"messages",
"messages.hello_language_not_exists",
"messages.hello_language_not_exists"
);
Expand Down

0 comments on commit 9715d28

Please sign in to comment.