diff --git a/pom.xml b/pom.xml index 9db663d..f1ebac8 100644 --- a/pom.xml +++ b/pom.xml @@ -262,7 +262,18 @@ test - non-modular + new-jvm,non-modular + + + + new-jvm + test + + test + + + new-jvm + false diff --git a/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_de.properties b/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_de.properties new file mode 100644 index 0000000..25b1715 --- /dev/null +++ b/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_de.properties @@ -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. + diff --git a/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_es_ES.properties b/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_es_ES.properties new file mode 100644 index 0000000..10bd6fb --- /dev/null +++ b/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_es_ES.properties @@ -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. + diff --git a/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_fr.properties b/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_fr.properties new file mode 100644 index 0000000..338e445 --- /dev/null +++ b/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_fr.properties @@ -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. + diff --git a/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_ja.properties b/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_ja.properties new file mode 100644 index 0000000..d04137b --- /dev/null +++ b/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_ja.properties @@ -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 + diff --git a/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_pt_BR.properties b/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_pt_BR.properties new file mode 100644 index 0000000..6a8a4d1 --- /dev/null +++ b/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_pt_BR.properties @@ -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. + diff --git a/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_zh_CN.properties b/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_zh_CN.properties new file mode 100644 index 0000000..22195e7 --- /dev/null +++ b/src/main/resources/org/wildfly/core/launcher/logger/LauncherMessages.i18n_zh_CN.properties @@ -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 + diff --git a/src/test/java/org/wildfly/core/launcher/logger/ChineseLocalizationTest.java b/src/test/java/org/wildfly/core/launcher/logger/ChineseLocalizationTest.java new file mode 100644 index 0000000..45e8716 --- /dev/null +++ b/src/test/java/org/wildfly/core/launcher/logger/ChineseLocalizationTest.java @@ -0,0 +1,15 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.wildfly.core.launcher.logger; + +/** + * @author James R. Perkins + */ +class ChineseLocalizationTest extends LocalizationTest { + ChineseLocalizationTest() { + super("zh-CN"); + } +} diff --git a/src/test/java/org/wildfly/core/launcher/logger/FrenchLocalizationTest.java b/src/test/java/org/wildfly/core/launcher/logger/FrenchLocalizationTest.java new file mode 100644 index 0000000..008b076 --- /dev/null +++ b/src/test/java/org/wildfly/core/launcher/logger/FrenchLocalizationTest.java @@ -0,0 +1,15 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.wildfly.core.launcher.logger; + +/** + * @author James R. Perkins + */ +class FrenchLocalizationTest extends LocalizationTest { + FrenchLocalizationTest() { + super("fr"); + } +} diff --git a/src/test/java/org/wildfly/core/launcher/logger/GermanLocalizationTest.java b/src/test/java/org/wildfly/core/launcher/logger/GermanLocalizationTest.java new file mode 100644 index 0000000..04a8e3d --- /dev/null +++ b/src/test/java/org/wildfly/core/launcher/logger/GermanLocalizationTest.java @@ -0,0 +1,15 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.wildfly.core.launcher.logger; + +/** + * @author James R. Perkins + */ +class GermanLocalizationTest extends LocalizationTest { + GermanLocalizationTest() { + super("de"); + } +} diff --git a/src/test/java/org/wildfly/core/launcher/logger/JapaneseLocalizationTest.java b/src/test/java/org/wildfly/core/launcher/logger/JapaneseLocalizationTest.java new file mode 100644 index 0000000..056e81b --- /dev/null +++ b/src/test/java/org/wildfly/core/launcher/logger/JapaneseLocalizationTest.java @@ -0,0 +1,15 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.wildfly.core.launcher.logger; + +/** + * @author James R. Perkins + */ +class JapaneseLocalizationTest extends LocalizationTest { + JapaneseLocalizationTest() { + super("ja"); + } +} diff --git a/src/test/java/org/wildfly/core/launcher/logger/LocalizationTest.java b/src/test/java/org/wildfly/core/launcher/logger/LocalizationTest.java new file mode 100644 index 0000000..cf24935 --- /dev/null +++ b/src/test/java/org/wildfly/core/launcher/logger/LocalizationTest.java @@ -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 James R. Perkins + */ +@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; + } + } +} diff --git a/src/test/java/org/wildfly/core/launcher/logger/PortugueseLocalizationTest.java b/src/test/java/org/wildfly/core/launcher/logger/PortugueseLocalizationTest.java new file mode 100644 index 0000000..30a9cde --- /dev/null +++ b/src/test/java/org/wildfly/core/launcher/logger/PortugueseLocalizationTest.java @@ -0,0 +1,15 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.wildfly.core.launcher.logger; + +/** + * @author James R. Perkins + */ +class PortugueseLocalizationTest extends LocalizationTest { + PortugueseLocalizationTest() { + super("pt-BR"); + } +} diff --git a/src/test/java/org/wildfly/core/launcher/logger/SpanishLocalizationTest.java b/src/test/java/org/wildfly/core/launcher/logger/SpanishLocalizationTest.java new file mode 100644 index 0000000..70d81d8 --- /dev/null +++ b/src/test/java/org/wildfly/core/launcher/logger/SpanishLocalizationTest.java @@ -0,0 +1,15 @@ +/* + * Copyright The WildFly Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +package org.wildfly.core.launcher.logger; + +/** + * @author James R. Perkins + */ +class SpanishLocalizationTest extends LocalizationTest { + SpanishLocalizationTest() { + super("es-ES"); + } +}