-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from jamezp/issue8
[8] Add the translations for the messages. Create some tests to ensur…
- Loading branch information
Showing
14 changed files
with
381 additions
and
1 deletion.
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
37 changes: 37 additions & 0 deletions
37
src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_de.properties
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
##################################################################################################### | ||
# | ||
# This file is for reference only, changes have no effect on the generated interface implementations. | ||
# | ||
##################################################################################################### | ||
|
||
# Id: 1 | ||
# Message: The path '%s' does not exist | ||
# @param 1: path - the path that does not exist | ||
pathDoesNotExist=Der Pfad '%1$s' existiert nicht | ||
# Id: 2 | ||
# Message: The directory '%s' is not a valid directory | ||
# @param 1: dir - | ||
invalidDirectory.1=Das Verzeichnis '%1$s' ist kein g\u00FCltiges Verzeichnis | ||
# Id: 3 | ||
# Message: Invalid directory, could not find '%s' in '%s' | ||
# @param 1: filename - | ||
# @param 2: dir - | ||
invalidDirectory.2=Ung\u00FCltiges Verzeichnis, '%1$s' konnte nicht in '%2$s' gefunden werden | ||
# Id: 4 | ||
# Message: Path '%s' is not a regular file. | ||
# @param 1: path - | ||
pathNotAFile=Pfad '%1$s' ist keine regul\u00E4re Datei. | ||
# Id: 5 | ||
# Message: The parameter %s cannot be null. | ||
# @param 1: name - | ||
nullParam=Der Parameter %1$s kann nicht leer sein. | ||
# Id: 6 | ||
# Message: Invalid hostname: %s | ||
# @param 1: hostname - | ||
invalidHostname=Ung\u00FCltiger Hostname: %1$s | ||
# Id: 7 | ||
# Message: The argument %s is not allowed for %s. | ||
# @param 1: argument - | ||
# @param 2: methodName - | ||
invalidArgument=Das Argument %1$s ist f\u00FCr %2$s nicht zul\u00E4ssig. | ||
|
37 changes: 37 additions & 0 deletions
37
src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_es_ES.properties
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
##################################################################################################### | ||
# | ||
# This file is for reference only, changes have no effect on the generated interface implementations. | ||
# | ||
##################################################################################################### | ||
|
||
# Id: 1 | ||
# Message: The path '%s' does not exist | ||
# @param 1: path - the path that does not exist | ||
pathDoesNotExist=La ruta '%1$s' no existe | ||
# Id: 2 | ||
# Message: The directory '%s' is not a valid directory | ||
# @param 1: dir - | ||
invalidDirectory.1=El directorio '%1$s' no es un directorio v\u00E1lido | ||
# Id: 3 | ||
# Message: Invalid directory, could not find '%s' in '%s' | ||
# @param 1: filename - | ||
# @param 2: dir - | ||
invalidDirectory.2=Directorio no v\u00E1lido, no se pudo encontrar '%1$s' en '%2$s' | ||
# Id: 4 | ||
# Message: Path '%s' is not a regular file. | ||
# @param 1: path - | ||
pathNotAFile=La ruta '%1$s' no es un archivo regular. | ||
# Id: 5 | ||
# Message: The parameter %s cannot be null. | ||
# @param 1: name - | ||
nullParam=El par\u00E1metro %1$s no puede ser nulo. | ||
# Id: 6 | ||
# Message: Invalid hostname: %s | ||
# @param 1: hostname - | ||
invalidHostname=Nombre de host no v\u00E1lido: %1$s | ||
# Id: 7 | ||
# Message: The argument %s is not allowed for %s. | ||
# @param 1: argument - | ||
# @param 2: methodName - | ||
invalidArgument=No se permite el argumento %1$s para %2$s. | ||
|
37 changes: 37 additions & 0 deletions
37
src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_fr.properties
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
##################################################################################################### | ||
# | ||
# This file is for reference only, changes have no effect on the generated interface implementations. | ||
# | ||
##################################################################################################### | ||
|
||
# Id: 1 | ||
# Message: The path '%s' does not exist | ||
# @param 1: path - the path that does not exist | ||
pathDoesNotExist=Le chemin d'acc\u00E8s '%1$s' est inexistant | ||
# Id: 2 | ||
# Message: The directory '%s' is not a valid directory | ||
# @param 1: dir - | ||
invalidDirectory.1=Le r\u00E9pertoire '%1$s' n'est pas valide | ||
# Id: 3 | ||
# Message: Invalid directory, could not find '%s' in '%s' | ||
# @param 1: filename - | ||
# @param 2: dir - | ||
invalidDirectory.2=R\u00E9pertoire non valide, impossible de trouver '%1$s' dans '%2$s' | ||
# Id: 4 | ||
# Message: Path '%s' is not a regular file. | ||
# @param 1: path - | ||
pathNotAFile=Le chemin d'acc\u00E8s '%1$s' n'est pas un fichier standard. | ||
# Id: 5 | ||
# Message: The parameter %s cannot be null. | ||
# @param 1: name - | ||
nullParam=Le param\u00E8tre %1$s ne peut \u00EAtre vide. | ||
# Id: 6 | ||
# Message: Invalid hostname: %s | ||
# @param 1: hostname - | ||
invalidHostname=Nom d'h\u00F4te non valide\u00A0: %1$s | ||
# Id: 7 | ||
# Message: The argument %s is not allowed for %s. | ||
# @param 1: argument - | ||
# @param 2: methodName - | ||
invalidArgument=L'argument %1$s n\u2019est pas autoris\u00E9 pour %2$s. | ||
|
37 changes: 37 additions & 0 deletions
37
src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_ja.properties
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
##################################################################################################### | ||
# | ||
# This file is for reference only, changes have no effect on the generated interface implementations. | ||
# | ||
##################################################################################################### | ||
|
||
# Id: 1 | ||
# Message: The path '%s' does not exist | ||
# @param 1: path - the path that does not exist | ||
pathDoesNotExist=\u30D1\u30B9 '%1$s' \u306F\u5B58\u5728\u3057\u307E\u305B\u3093 | ||
# Id: 2 | ||
# Message: The directory '%s' is not a valid directory | ||
# @param 1: dir - | ||
invalidDirectory.1=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30FC '%1$s' \u306F\u6709\u52B9\u306A\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30FC\u3067\u306F\u3042\u308A\u307E\u305B\u3093 | ||
# Id: 3 | ||
# Message: Invalid directory, could not find '%s' in '%s' | ||
# @param 1: filename - | ||
# @param 2: dir - | ||
invalidDirectory.2=\u7121\u52B9\u306A\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30FC\u3001'%2$s' \u3067 '%1$s' \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3067\u3057\u305F | ||
# Id: 4 | ||
# Message: Path '%s' is not a regular file. | ||
# @param 1: path - | ||
pathNotAFile=\u30D1\u30B9 '%1$s' \u306F\u901A\u5E38\u306E\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002 | ||
# Id: 5 | ||
# Message: The parameter %s cannot be null. | ||
# @param 1: name - | ||
nullParam=\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC %1$s \u3092 null \u306B\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002 | ||
# Id: 6 | ||
# Message: Invalid hostname: %s | ||
# @param 1: hostname - | ||
invalidHostname=\u7121\u52B9\u306A\u30DB\u30B9\u30C8\u540D: %1$s | ||
# Id: 7 | ||
# Message: The argument %s is not allowed for %s. | ||
# @param 1: argument - | ||
# @param 2: methodName - | ||
invalidArgument=\u5F15\u6570 %1$s \u306F\u3001%2$s \u306B\u306F\u8A31\u53EF\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 | ||
|
37 changes: 37 additions & 0 deletions
37
src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_pt_BR.properties
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
##################################################################################################### | ||
# | ||
# This file is for reference only, changes have no effect on the generated interface implementations. | ||
# | ||
##################################################################################################### | ||
|
||
# Id: 1 | ||
# Message: The path '%s' does not exist | ||
# @param 1: path - the path that does not exist | ||
pathDoesNotExist=O caminho '%1$s' n\u00E3o existe | ||
# Id: 2 | ||
# Message: The directory '%s' is not a valid directory | ||
# @param 1: dir - | ||
invalidDirectory.1=O diret\u00F3rio '%1$s' n\u00E3o \u00E9 um diret\u00F3rio v\u00E1lido | ||
# Id: 3 | ||
# Message: Invalid directory, could not find '%s' in '%s' | ||
# @param 1: filename - | ||
# @param 2: dir - | ||
invalidDirectory.2=Diret\u00F3rio inv\u00E1lido, n\u00E3o foi poss\u00EDvel encontrar '%1$s' em '%2$s' | ||
# Id: 4 | ||
# Message: Path '%s' is not a regular file. | ||
# @param 1: path - | ||
pathNotAFile=O caminho '%1$s' n\u00E3o \u00E9 um arquivo comum. | ||
# Id: 5 | ||
# Message: The parameter %s cannot be null. | ||
# @param 1: name - | ||
nullParam=O par\u00E2metro %1$s n\u00E3o pode ser nulo. | ||
# Id: 6 | ||
# Message: Invalid hostname: %s | ||
# @param 1: hostname - | ||
invalidHostname=Nome de host inv\u00E1lido: %1$s | ||
# Id: 7 | ||
# Message: The argument %s is not allowed for %s. | ||
# @param 1: argument - | ||
# @param 2: methodName - | ||
invalidArgument=O argumento %1$s n\u00E3o \u00E9 permitido para %2$s. | ||
|
37 changes: 37 additions & 0 deletions
37
src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_zh_CN.properties
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
##################################################################################################### | ||
# | ||
# This file is for reference only, changes have no effect on the generated interface implementations. | ||
# | ||
##################################################################################################### | ||
|
||
# Id: 1 | ||
# Message: The path '%s' does not exist | ||
# @param 1: path - the path that does not exist | ||
pathDoesNotExist=\u8DEF\u5F84 '%1$s' \u4E0D\u5B58\u5728 | ||
# Id: 2 | ||
# Message: The directory '%s' is not a valid directory | ||
# @param 1: dir - | ||
invalidDirectory.1=\u76EE\u5F55 '%1$s' \u4E0D\u662F\u4E00\u4E2A\u6709\u6548\u76EE\u5F55 | ||
# Id: 3 | ||
# Message: Invalid directory, could not find '%s' in '%s' | ||
# @param 1: filename - | ||
# @param 2: dir - | ||
invalidDirectory.2=\u65E0\u6548\u76EE\u5F55\uFF0C\u65E0\u6CD5\u5728 '%2$s' \u91CC\u627E\u5230 '%1$s'\u3002 | ||
# Id: 4 | ||
# Message: Path '%s' is not a regular file. | ||
# @param 1: path - | ||
pathNotAFile=\u8DEF\u5F84 '%1$s' \u4E0D\u662F\u4E00\u4E2A\u5E38\u89C4\u6587\u4EF6\u3002 | ||
# Id: 5 | ||
# Message: The parameter %s cannot be null. | ||
# @param 1: name - | ||
nullParam=\u53C2\u6570 %1$s \u4E0D\u80FD\u4E3A\u7A7A\u3002 | ||
# Id: 6 | ||
# Message: Invalid hostname: %s | ||
# @param 1: hostname - | ||
invalidHostname=\u65E0\u6548\u7684\u4E3B\u673A\u540D\uFF1A'%1$s' | ||
# Id: 7 | ||
# Message: The argument %s is not allowed for %s. | ||
# @param 1: argument - | ||
# @param 2: methodName - | ||
invalidArgument=%2$s \u4E0D\u5141\u8BB8\u4F7F\u7528\u53C2\u6570 %1$s\u3002 | ||
|
15 changes: 15 additions & 0 deletions
15
src/test/java/org/wildfly/core/launcher/logger/ChineseLocalizationTest.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.core.launcher.logger; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
class ChineseLocalizationTest extends LocalizationTest { | ||
ChineseLocalizationTest() { | ||
super("zh-CN"); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/java/org/wildfly/core/launcher/logger/FrenchLocalizationTest.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.core.launcher.logger; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
class FrenchLocalizationTest extends LocalizationTest { | ||
FrenchLocalizationTest() { | ||
super("fr"); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/java/org/wildfly/core/launcher/logger/GermanLocalizationTest.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.core.launcher.logger; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
class GermanLocalizationTest extends LocalizationTest { | ||
GermanLocalizationTest() { | ||
super("de"); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/java/org/wildfly/core/launcher/logger/JapaneseLocalizationTest.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.core.launcher.logger; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
class JapaneseLocalizationTest extends LocalizationTest { | ||
JapaneseLocalizationTest() { | ||
super("ja"); | ||
} | ||
} |
57 changes: 57 additions & 0 deletions
57
src/test/java/org/wildfly/core/launcher/logger/LocalizationTest.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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.core.launcher.logger; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.nio.file.Path; | ||
import java.util.Properties; | ||
|
||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Tag; | ||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
@Tag("new-jvm") | ||
// | ||
abstract class LocalizationTest { | ||
private final String bcp47Tag; | ||
|
||
LocalizationTest(final String bcp47Tag) { | ||
System.setProperty("org.jboss.logging.locale", bcp47Tag); | ||
this.bcp47Tag = bcp47Tag; | ||
} | ||
|
||
@Test | ||
void className() { | ||
final String className = LauncherMessages.MESSAGES.getClass().getSimpleName(); | ||
final String expectedClassName = String.format("LauncherMessages_$bundle_%s", bcp47Tag.replace('-', '_')); | ||
// Check that we loaded the correct class based on the locale | ||
Assertions.assertEquals(expectedClassName, className); | ||
} | ||
|
||
@Test | ||
void checkMessage() throws Exception { | ||
final Properties properties = loadProperties(); | ||
final Path pathName = Path.of("path"); | ||
// Compare the message from the translation file to the message from the message interface | ||
Assertions.assertEquals(String.format("WFLYLNCHR0001: " + properties.getProperty("pathDoesNotExist"), pathName), | ||
LauncherMessages.MESSAGES.pathDoesNotExist(pathName).getMessage()); | ||
} | ||
|
||
private Properties loadProperties() throws IOException { | ||
// Load the properties file which contains the translations. | ||
String resourceName = String.format("LauncherMessages.i18n_%s.properties", bcp47Tag.replace('-', '_')); | ||
try (InputStream stream = getClass().getResourceAsStream(resourceName)) { | ||
Assertions.assertNotNull(stream, "Could not find translations for " + resourceName); | ||
Properties properties = new Properties(); | ||
properties.load(stream); | ||
return properties; | ||
} | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/test/java/org/wildfly/core/launcher/logger/PortugueseLocalizationTest.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright The WildFly Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.wildfly.core.launcher.logger; | ||
|
||
/** | ||
* @author <a href="mailto:[email protected]">James R. Perkins</a> | ||
*/ | ||
class PortugueseLocalizationTest extends LocalizationTest { | ||
PortugueseLocalizationTest() { | ||
super("pt-BR"); | ||
} | ||
} |
Oops, something went wrong.