added theme name as parameter
moved messages to theme bundle Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
parent
9c37cdd0ac
commit
941457b805
12 changed files with 13 additions and 4 deletions
|
@ -103,15 +103,23 @@ public class ThemeResource {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("/{realm}/{theme}/{locale}")
|
@Path("/{realm}/{themeType}/{locale}")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public Response getLocalizationTexts(@PathParam("realm") String realmName, @PathParam("theme") String theme,
|
public Response getLocalizationTexts(@PathParam("realm") String realmName, @QueryParam("theme") String theme,
|
||||||
@PathParam("locale") String localeString, @QueryParam("source") boolean showSource) throws IOException {
|
@PathParam("locale") String localeString, @PathParam("themeType") String themeType,
|
||||||
|
@QueryParam("source") boolean showSource) throws IOException {
|
||||||
final RealmModel realm = session.realms().getRealmByName(realmName);
|
final RealmModel realm = session.realms().getRealmByName(realmName);
|
||||||
session.getContext().setRealm(realm);
|
session.getContext().setRealm(realm);
|
||||||
List<KeySource> result;
|
List<KeySource> result;
|
||||||
|
|
||||||
Theme theTheme = session.theme().getTheme(Theme.Type.valueOf(theme.toUpperCase()));
|
Theme theTheme;
|
||||||
|
final Theme.Type type = Theme.Type.valueOf(themeType.toUpperCase());
|
||||||
|
if (theme == null) {
|
||||||
|
theTheme = session.theme().getTheme(type);
|
||||||
|
} else {
|
||||||
|
theTheme = session.theme().getTheme(theme, type);
|
||||||
|
}
|
||||||
|
|
||||||
final Locale locale = Locale.forLanguageTag(localeString);
|
final Locale locale = Locale.forLanguageTag(localeString);
|
||||||
if (showSource) {
|
if (showSource) {
|
||||||
Properties messagesByLocale = theTheme.getMessages("messages", locale);
|
Properties messagesByLocale = theTheme.getMessages("messages", locale);
|
||||||
|
@ -139,6 +147,7 @@ enum Source {
|
||||||
THEME,
|
THEME,
|
||||||
REALM
|
REALM
|
||||||
}
|
}
|
||||||
|
|
||||||
class KeySource {
|
class KeySource {
|
||||||
private String key;
|
private String key;
|
||||||
private String value;
|
private String value;
|
||||||
|
|
Loading…
Reference in a new issue