-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix MessageBundle key/file name resolver algorithm
- Loading branch information
Showing
9 changed files
with
179 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
74 changes: 74 additions & 0 deletions
74
extensions/qute/deployment/src/test/java/io/quarkus/qute/deployment/i18n/EmailBundles.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,74 @@ | ||
package io.quarkus.qute.deployment.i18n; | ||
|
||
import io.quarkus.qute.i18n.Message; | ||
import io.quarkus.qute.i18n.MessageBundle; | ||
|
||
public class EmailBundles { | ||
@MessageBundle | ||
interface template { | ||
@Message | ||
String title(); | ||
|
||
String logoUrl(); | ||
|
||
@Message | ||
String signDocument(); | ||
|
||
@Message | ||
String viewDocument(); | ||
|
||
@Message | ||
String addToContacts(String email); | ||
|
||
@Message | ||
String about(); | ||
|
||
@Message | ||
String help(); | ||
|
||
@Message | ||
String legalInfo(); | ||
|
||
@Message | ||
String spam(); | ||
} | ||
|
||
@MessageBundle | ||
interface started { | ||
@Message | ||
String started(String id, String filename); | ||
|
||
@Message | ||
String documentAccessUrl(String url); | ||
|
||
@Message | ||
String nextNotification(); | ||
|
||
@Message | ||
String signingProcessStart(String id, String filename); | ||
|
||
@Message | ||
String subject(String customer, String filename); | ||
|
||
@Message | ||
String signForValidation(); | ||
} | ||
|
||
@MessageBundle | ||
interface startedValidator { | ||
@Message | ||
String started(String id, String filename); | ||
|
||
@Message | ||
String turnEmailWillBeSent(); | ||
|
||
@Message | ||
String youMayAlreadyAccessDocument(); | ||
|
||
@Message | ||
String subject(String customer, String filename); | ||
|
||
@Message | ||
String signForValidation(); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...loyment/src/test/java/io/quarkus/qute/deployment/i18n/MessageBundleNameCollisionTest.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,40 @@ | ||
package io.quarkus.qute.deployment.i18n; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
import jakarta.inject.Inject; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.qute.Engine; | ||
import io.quarkus.qute.i18n.MessageBundles; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
|
||
public class MessageBundleNameCollisionTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusUnitTest config = new QuarkusUnitTest() | ||
.overrideConfigKey("quarkus.default-locale", "en_US") | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(EmailBundles.class) | ||
.addAsResource("messages/EmailBundles_started.properties") | ||
.addAsResource("messages/EmailBundles_started_en.properties") | ||
.addAsResource("messages/EmailBundles_startedValidator.properties") | ||
.addAsResource("messages/EmailBundles_startedValidator_en.properties") | ||
.addAsResource("messages/EmailBundles_template.properties") | ||
.addAsResource("messages/EmailBundles_template_en.properties")); | ||
|
||
@Inject | ||
Engine engine; | ||
|
||
@Test | ||
public void testBundleMethodIsFound() { | ||
EmailBundles.startedValidator startedValidator = MessageBundles.get(EmailBundles.startedValidator.class); | ||
assertEquals("You will be notified with another email when it is your turn to sign.", | ||
startedValidator.turnEmailWillBeSent()); | ||
assertEquals("You will be notified with another email when it is your turn to sign.", | ||
engine.parse("{EmailBundles_startedValidator:turnEmailWillBeSent()}").render()); | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
extensions/qute/deployment/src/test/resources/messages/EmailBundles_started.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,6 @@ | ||
started=In this process you will sign the document to validate it. | ||
signingProcessStart=you have started a signing process {id} for document "{filename}". | ||
nextNotification=You will be notified with another email when it is your signing turn. | ||
documentAccessUrl=You may access the document in the following link: | ||
subject=Signing process initiated by {customer} for file {filename}. | ||
signForValidation=In this process you will sign the document to validate it. |
5 changes: 5 additions & 0 deletions
5
...ions/qute/deployment/src/test/resources/messages/EmailBundles_startedValidator.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,5 @@ | ||
signForValidation=In this process you will sign the document to validate it. | ||
started=has started a signing process {id} for the document "{filename}". | ||
subject=Signing process initiated by {customer} for file {filename}. | ||
turnEmailWillBeSent=You will be notified with another email when it is your turn to sign. | ||
youMayAlreadyAccessDocument=You can access the document at the following link: |
5 changes: 5 additions & 0 deletions
5
...s/qute/deployment/src/test/resources/messages/EmailBundles_startedValidator_en.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,5 @@ | ||
signForValidation=In this process you will sign the document to validate it. | ||
started=has started a signing process {id} for the document "{filename}". | ||
subject=Signing process initiated by {customer} for file {filename}. | ||
turnEmailWillBeSent=You will be notified with another email when it is your turn to sign. | ||
youMayAlreadyAccessDocument=You can access the document at the following link: |
6 changes: 6 additions & 0 deletions
6
extensions/qute/deployment/src/test/resources/messages/EmailBundles_started_en.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,6 @@ | ||
started=In this process you will sign the document to validate it. | ||
signingProcessStart=you have started a signing process {id} for document "{filename}". | ||
nextNotification=You will be notified with another email when it is your signing turn. | ||
documentAccessUrl=You may access the document in the following link: | ||
subject=Signing process initiated by {customer} for file {filename}. | ||
signForValidation=In this process you will sign the document to validate it. |
9 changes: 9 additions & 0 deletions
9
extensions/qute/deployment/src/test/resources/messages/EmailBundles_template.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,9 @@ | ||
addToContacts=Para asegurarte que llegan nuestros correos electrónicos, añade. | ||
logoUrl=https://localhost | ||
title=title | ||
viewDocument=View Document | ||
about=ABOUT | ||
help=HELP | ||
legalInfo=LEGAL CONDITIONS | ||
spam=SPAM | ||
signDocument=Sign Document |
9 changes: 9 additions & 0 deletions
9
extensions/qute/deployment/src/test/resources/messages/EmailBundles_template_en.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,9 @@ | ||
title=title | ||
logoUrl=localhost | ||
viewDocument=View Document | ||
addToContacts=Make sure that our emails are delivered adding the following address | ||
spam=DENUNCIAR TRANSFERENCIA COMO SPAM | ||
legalInfo=LEGAL CONDITIONS | ||
help=AYUDA | ||
about=ABOUT | ||
signDocument=Sign Document |