Skip to content

Commit

Permalink
feat: Expose the ResourceBundle on L10nMessages
Browse files Browse the repository at this point in the history
This is useful to be able to list the keys when using {@link EnumType#NO_KEYS}
  • Loading branch information
aurambaj committed Jan 12, 2024
1 parent b2aa1d4 commit 08073bb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,15 @@ public Locale getLocale() {
return locale;
}

/**
* Get the resource bundle used to load the messages.
*
* @return the resource bundle used to load the messages
*/
public ResourceBundle getResourceBundle() {
return resourceBundle;
}

/**
* Format a message for an "untyped" key and a given map of arguments.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ void getLocale() {
assertThat(m.getLocale()).isEqualTo(Locale.FRANCE);
}

@Test
void getResourceBundle() {
L10nMessages<com.pinterest.l10nmessages.Messages> m =
L10nMessages.builder(Messages.class).build();
assertThat(m.getResourceBundle().keySet().size()).isEqualTo(15);
}

@Test
public void enumTypedFormat() {
L10nMessages<com.pinterest.l10nmessages.Messages> m =
Expand Down

0 comments on commit 08073bb

Please sign in to comment.