-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/0.0.2' into main
- Loading branch information
Showing
21 changed files
with
206 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,31 @@ | ||
# commons-i18n-l10n | ||
Helper methods to facilitate i18n and l10n concerns | ||
|
||
|
||
|
||
## Usage | ||
|
||
### assertions | ||
|
||
```java | ||
enum TestAppLanguages implements AppLanguage { | ||
DE(ULocale.forLanguageTag("de-CH")), | ||
FR(ULocale.forLanguageTag("fr-CH")); | ||
// code omitted for brevity | ||
} | ||
|
||
// business code | ||
public I18nMessage sayHello(String toWho) { | ||
return I18nMessage.of("hello.world", "world", toWho); | ||
} | ||
|
||
// test code | ||
@Test | ||
public void has_all_translations_for_hello_world() { | ||
assertThatI18nMessage(sayHello("World")) | ||
.usingTLFactory(tlFactory) | ||
.translatesTo(TestAppLanguages.DE, "Hallo World") | ||
.translatesTo(TestAppLanguages.FR, "Bonjour World") | ||
.hasAllLanguagesTranslated(TestAppLanguages.values()); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 0 additions & 79 deletions
79
api/src/main/java/ch/dvbern/oss/commons/i18nl10n/AbstractTL.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 14 additions & 22 deletions
36
api/src/main/java/ch/dvbern/oss/commons/i18nl10n/I18nKey.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 9 additions & 16 deletions
25
api/src/main/java/ch/dvbern/oss/commons/i18nl10n/I18nMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
api/src/main/java/ch/dvbern/oss/commons/i18nl10n/TLFactory.java
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
api/src/main/java/ch/dvbern/oss/commons/i18nl10n/Translator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
package ch.dvbern.oss.commons.i18nl10n; | ||
|
||
/** | ||
* Basic workhorse for translation purposes. See {@link TL} for a more convenient interface. | ||
*/ | ||
@SuppressWarnings("InterfaceNeverImplemented") | ||
public interface Translator { | ||
String translate(I18nMessage message); | ||
} |
Oops, something went wrong.