Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http://openid.net/specs/openid-connect-core-1_0.html#rfc.section.3.1.2 replace ' through '' and introduce msg method for i18n in *.ftl files replace ' through '' and introduce msg method for i18n in *.ftl files css dorpdown get current url with locale as query parameter Introduce LocaleBean add css dropdown to account page css styling... css styling...
- Loading branch information
1 parent
de4c05e
commit d8193f0
Showing
41 changed files
with
426 additions
and
223 deletions.
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
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
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
58 changes: 58 additions & 0 deletions
58
forms/common-freemarker/src/main/java/org/keycloak/freemarker/beans/LocaleBean.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
package org.keycloak.freemarker.beans; | |||
|
|||
import org.keycloak.freemarker.LocaleHelper; | |||
import org.keycloak.models.RealmModel; | |||
|
|||
import javax.ws.rs.core.UriBuilder; | |||
import java.util.LinkedList; | |||
import java.util.List; | |||
import java.util.Properties; | |||
|
|||
/** | |||
* @author <a href="mailto:sthorger@redhat.com">Stian Thorgersen</a> | |||
*/ | |||
public class LocaleBean { | |||
|
|||
private String current; | |||
private List<Locale> supported; | |||
|
|||
public LocaleBean(RealmModel realm, java.util.Locale current, UriBuilder uriBuilder, Properties messages) { | |||
this.current = messages.getProperty("locale_" + current.toLanguageTag(), current.toLanguageTag()); | |||
|
|||
supported = new LinkedList<>(); | |||
for (String l : realm.getSupportedLocales()) { | |||
String label = messages.getProperty("locale_" + l, l); | |||
String url = uriBuilder.replaceQueryParam(LocaleHelper.KC_LOCALE_PARAM, l).build().toString(); | |||
supported.add(new Locale(label, url)); | |||
} | |||
} | |||
|
|||
public String getCurrent() { | |||
return current; | |||
} | |||
|
|||
public List<Locale> getSupported() { | |||
return supported; | |||
} | |||
|
|||
public static class Locale { | |||
|
|||
private String label; | |||
private String url; | |||
|
|||
public Locale(String label, String url) { | |||
this.label = label; | |||
this.url = url; | |||
} | |||
|
|||
public String getUrl() { | |||
return url; | |||
} | |||
|
|||
public String getLabel() { | |||
return label; | |||
} | |||
|
|||
} | |||
|
|||
} |
32 changes: 32 additions & 0 deletions
32
...common-freemarker/src/main/java/org/keycloak/freemarker/beans/MessageFormatterMethod.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 | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
package org.keycloak.freemarker.beans; | |||
|
|||
import freemarker.template.TemplateMethodModelEx; | |||
import freemarker.template.TemplateModelException; | |||
|
|||
import java.text.MessageFormat; | |||
import java.util.List; | |||
import java.util.Locale; | |||
import java.util.Properties; | |||
|
|||
/** | |||
* @author <a href="mailto:gerbermichi@me.com">Michael Gerber</a> | |||
*/ | |||
public class MessageFormatterMethod implements TemplateMethodModelEx { | |||
private final Properties messages; | |||
private final Locale locale; | |||
|
|||
public MessageFormatterMethod(Locale locale, Properties messages) { | |||
this.locale = locale; | |||
this.messages = messages; | |||
} | |||
|
|||
@Override | |||
public Object exec(List list) throws TemplateModelException { | |||
String key = list.get(0).toString(); | |||
if (list.size() >= 1) { | |||
return new MessageFormat(messages.getProperty(key,key),locale).format(list.subList(1, list.size()).toArray()); | |||
} else { | |||
return null; | |||
} | |||
} | |||
} |
19 changes: 0 additions & 19 deletions
19
forms/common-freemarker/src/main/java/org/keycloak/freemarker/beans/TextFormatterBean.java
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.