elAppMessages) {
- this.enAppMessages = enAppMessages.iterator().next();
- this.elAppMessages = elAppMessages.iterator().next();
- }
-
- public AlertMessages appMessages(String lang) {
- switch (lang) {
- case "el":
- return elAppMessages;
- case "en":
- default:
- return enAppMessages;
- }
- }
-}
diff --git a/qute/multimodule/qute-api/src/main/java/io/quarkus/qe/qute/api/ExampleResource.java b/qute/multimodule/qute-api/src/main/java/io/quarkus/qe/qute/api/ExampleResource.java
deleted file mode 100644
index eff7db39b..000000000
--- a/qute/multimodule/qute-api/src/main/java/io/quarkus/qe/qute/api/ExampleResource.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package io.quarkus.qe.qute.api;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-@Path("/hello")
-public class ExampleResource {
-
- private final AppMessagesProvider appMessagesProvider;
-
- public ExampleResource(AppMessagesProvider appMessagesProvider) {
- this.appMessagesProvider = appMessagesProvider;
- }
-
- @GET
- @Path("{lang}")
- @Produces(MediaType.TEXT_PLAIN)
- public String hello(@PathParam("lang") String lang) {
- AlertMessages appMessages = appMessagesProvider.appMessages(lang);
- return appMessages.withoutParams() + ". " + appMessages.withParams("Nikos");
- }
-}
diff --git a/qute/multimodule/qute-api/src/main/java/io/quarkus/qe/qute/api/MyQuteMessages.java b/qute/multimodule/qute-api/src/main/java/io/quarkus/qe/qute/api/MyQuteMessages.java
new file mode 100644
index 000000000..c376f30ae
--- /dev/null
+++ b/qute/multimodule/qute-api/src/main/java/io/quarkus/qe/qute/api/MyQuteMessages.java
@@ -0,0 +1,13 @@
+package io.quarkus.qe.qute.api;
+
+import io.quarkus.qute.i18n.Message;
+import io.quarkus.qute.i18n.MessageBundle;
+
+@MessageBundle
+public interface MyQuteMessages {
+ @Message("Hello world!")
+ String hello();
+
+ @Message("Hello {name}!")
+ String hello_name(String name);
+}
diff --git a/qute/multimodule/qute-api/src/main/java/io/quarkus/qe/qute/api/MyQuteResource.java b/qute/multimodule/qute-api/src/main/java/io/quarkus/qe/qute/api/MyQuteResource.java
new file mode 100644
index 000000000..d930fb036
--- /dev/null
+++ b/qute/multimodule/qute-api/src/main/java/io/quarkus/qe/qute/api/MyQuteResource.java
@@ -0,0 +1,62 @@
+package io.quarkus.qe.qute.api;
+
+import static java.util.Objects.requireNonNull;
+
+import java.util.Locale;
+
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
+import io.quarkus.qute.Template;
+import io.quarkus.qute.TemplateInstance;
+import io.quarkus.qute.i18n.Localized;
+import io.quarkus.qute.i18n.MessageBundles;
+
+@Path("/hello")
+public class MyQuteResource {
+ private final Template page;
+
+ @Inject
+ MyQuteMessages enAppMessages;
+ @Localized("cs")
+ MyQuteMessages csAppMessages;
+
+ @Inject
+ AlertMessages enAlertMessages;
+ @Localized("el")
+ AlertMessages elAlertMessages;
+
+ public MyQuteResource(Template page) {
+ this.page = requireNonNull(page, "page is required");
+ }
+
+ @GET
+ @Path("{lang}")
+ @Produces(MediaType.TEXT_PLAIN)
+ public String hello(@PathParam("lang") String lang) {
+ AlertMessages messages = lang.equals("el") ? elAlertMessages : enAlertMessages;
+ return messages.withoutParams() + ". " + messages.withParams("Nikos");
+ }
+
+ @GET
+ @Path("/names")
+ @Produces(MediaType.TEXT_PLAIN)
+ public String names() {
+ return MessageBundles.get(MyQuteMessages.class).hello_name("Rostislav") + " == " +
+ enAppMessages.hello_name("Rostislav") + " | " +
+ MessageBundles.get(MyQuteMessages.class, Localized.Literal.of("cs")).hello_name("Rostislav") + " == " +
+ csAppMessages.hello_name("Rostislav");
+ }
+
+ @GET
+ @Path("/page")
+ @Produces(MediaType.TEXT_HTML)
+ public TemplateInstance get(@QueryParam("name") String name) {
+ return page.data("name", name).setAttribute("locale", Locale.forLanguageTag("cs"));
+ }
+}
diff --git a/qute/multimodule/qute-api/src/main/resources/messages/alert_en.properties b/qute/multimodule/qute-api/src/main/resources/messages/alert_en.properties
deleted file mode 100644
index ef4782fe3..000000000
--- a/qute/multimodule/qute-api/src/main/resources/messages/alert_en.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-withoutParams=Hello
-withParams=Hello {name}
\ No newline at end of file
diff --git a/qute/multimodule/qute-api/src/main/resources/messages/msg_cs.properties b/qute/multimodule/qute-api/src/main/resources/messages/msg_cs.properties
new file mode 100644
index 000000000..bc04e6c3a
--- /dev/null
+++ b/qute/multimodule/qute-api/src/main/resources/messages/msg_cs.properties
@@ -0,0 +1,2 @@
+hello=Ahoj!
+hello_name=Ahoj {name}!
\ No newline at end of file
diff --git a/qute/multimodule/qute-api/src/main/resources/templates/page.qute.html b/qute/multimodule/qute-api/src/main/resources/templates/page.qute.html
new file mode 100644
index 000000000..efaf84a24
--- /dev/null
+++ b/qute/multimodule/qute-api/src/main/resources/templates/page.qute.html
@@ -0,0 +1,32 @@
+
+
+
+
+ Hello {name ?: "Qute"}
+
+
+
+Hello {name ?: "Qute"}
+
+{msg:hello} {msg:hello_name('Rostislav')}
+
+Create your web page using Quarkus RESTEasy & Qute
+
+
diff --git a/qute/multimodule/qute-test/pom.xml b/qute/multimodule/qute-test/pom.xml
index 0c35d4fca..9aa8ad97a 100644
--- a/qute/multimodule/qute-test/pom.xml
+++ b/qute/multimodule/qute-test/pom.xml
@@ -14,7 +14,6 @@
io.quarkus.ts.qe
qute-api
1.0.0-SNAPSHOT
- test
diff --git a/qute/multimodule/qute-test/src/test/resources/messages/alert_el.properties b/qute/multimodule/qute-test/src/main/resources/messages/alert_el.properties
similarity index 100%
rename from qute/multimodule/qute-test/src/test/resources/messages/alert_el.properties
rename to qute/multimodule/qute-test/src/main/resources/messages/alert_el.properties
diff --git a/qute/multimodule/qute-test/src/main/resources/messages/msg_cs.properties b/qute/multimodule/qute-test/src/main/resources/messages/msg_cs.properties
new file mode 100644
index 000000000..bc04e6c3a
--- /dev/null
+++ b/qute/multimodule/qute-test/src/main/resources/messages/msg_cs.properties
@@ -0,0 +1,2 @@
+hello=Ahoj!
+hello_name=Ahoj {name}!
\ No newline at end of file
diff --git a/qute/multimodule/qute-test/src/test/java/io/quarkus/qe/qute/LocalizedMessagesIT.java b/qute/multimodule/qute-test/src/test/java/io/quarkus/qe/qute/LocalizedMessagesIT.java
new file mode 100644
index 000000000..1194aca31
--- /dev/null
+++ b/qute/multimodule/qute-test/src/test/java/io/quarkus/qe/qute/LocalizedMessagesIT.java
@@ -0,0 +1,45 @@
+package io.quarkus.qe.qute;
+
+import static io.restassured.RestAssured.given;
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.is;
+
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+
+import io.quarkus.test.scenarios.QuarkusScenario;
+
+@QuarkusScenario
+class LocalizedMessagesIT {
+
+ @Tag("QUARKUS-1547")
+ @ParameterizedTest
+ @CsvSource({ "en, Hello. Hello Nikos", "el, Γειά. Γειά σου Nikos" })
+ void useLocalizedMessageInstance(String lang, String output) {
+ given()
+ .when().get("/hello/" + lang)
+ .then()
+ .statusCode(200)
+ .body(is(output));
+ }
+
+ @Test
+ void useMessageBundlesAndLocalizedAnnotation() {
+ given()
+ .when().get("/hello/names")
+ .then()
+ .statusCode(200)
+ .body(is("Hello Rostislav! == Hello Rostislav! | Ahoj Rostislav! == Ahoj Rostislav!"));
+ }
+
+ @Test
+ void useLocalizedTemplate() {
+ given()
+ .when().get("/hello/page")
+ .then()
+ .statusCode(200)
+ .body(containsString("Ahoj Rostislav!"));
+ }
+}
diff --git a/qute/multimodule/qute-test/src/test/java/io/quarkus/qe/qute/LocalizedMessagesTest.java b/qute/multimodule/qute-test/src/test/java/io/quarkus/qe/qute/LocalizedMessagesTest.java
deleted file mode 100644
index 635b8b414..000000000
--- a/qute/multimodule/qute-test/src/test/java/io/quarkus/qe/qute/LocalizedMessagesTest.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package io.quarkus.qe.qute;
-
-import static io.restassured.RestAssured.given;
-import static org.hamcrest.CoreMatchers.is;
-
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Tag;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.CsvSource;
-
-import io.quarkus.test.junit.QuarkusTest;
-
-@QuarkusTest
-class LocalizedMessagesTest {
-
- @Tag("QUARKUS-1547")
- @ParameterizedTest
- @CsvSource({ "en, Hello. Hello Nikos", "el, Γειά. Γειά σου Nikos" })
- //TODO https://github.com/quarkusio/quarkus/issues/19617
- @Disabled("@MessageBundle is not packaged and throw an exception")
- void useLocalizedMessageInstance(String lang, String output) {
- given()
- .when().get("/hello/" + lang)
- .then()
- .statusCode(200)
- .body(is(output));
- }
-}
diff --git a/qute/multimodule/qute-test/src/test/resources/META-INF/beans.xml b/qute/multimodule/qute-test/src/test/resources/META-INF/beans.xml
deleted file mode 100644
index e69de29bb..000000000
diff --git a/qute/multimodule/qute-test/src/test/resources/messages/alert_en.properties b/qute/multimodule/qute-test/src/test/resources/messages/alert_en.properties
deleted file mode 100644
index ef4782fe3..000000000
--- a/qute/multimodule/qute-test/src/test/resources/messages/alert_en.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-withoutParams=Hello
-withParams=Hello {name}
\ No newline at end of file