本文整理汇总了Java中play.i18n.Lang.code方法的典型用法代码示例。如果您正苦于以下问题:Java Lang.code方法的具体用法?Java Lang.code怎么用?Java Lang.code使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类play.i18n.Lang
的用法示例。
在下文中一共展示了Lang.code方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVerifyEmailMailingBody
import play.i18n.Lang; //导入方法依赖的package包/类
@Override
protected Body getVerifyEmailMailingBody(final String token,
final MyUsernamePasswordAuthUser user, final Context ctx) {
final boolean isSecure = getConfiguration().getBoolean(
SETTING_KEY_VERIFICATION_LINK_SECURE);
final String url = routes.Signup.verify(token).absoluteURL(
ctx.request(), isSecure);
final Lang lang = Lang.preferred(ctx.request().acceptLanguages());
final String langCode = lang.code();
final String html = getEmailTemplate(
"views.html.account.signup.email.verify_email", langCode, url,
token, user.getName(), user.getEmail());
final String text = getEmailTemplate(
"views.txt.account.signup.email.verify_email", langCode, url,
token, user.getName(), user.getEmail());
return new Body(text, html);
}
示例2: getPasswordResetMailingBody
import play.i18n.Lang; //导入方法依赖的package包/类
protected Body getPasswordResetMailingBody(final String token,
final User user, final Context ctx) {
final boolean isSecure = getConfiguration().getBoolean(
SETTING_KEY_PASSWORD_RESET_LINK_SECURE);
final String url = routes.Signup.resetPassword(token).absoluteURL(
ctx.request(), isSecure);
final Lang lang = Lang.preferred(ctx.request().acceptLanguages());
final String langCode = lang.code();
final String html = getEmailTemplate(
"views.html.account.email.password_reset", langCode, url,
token, user.name, user.email);
final String text = getEmailTemplate(
"views.txt.account.email.password_reset", langCode, url, token,
user.name, user.email);
return new Body(text, html);
}
示例3: getVerifyEmailMailingBodyAfterSignup
import play.i18n.Lang; //导入方法依赖的package包/类
protected Body getVerifyEmailMailingBodyAfterSignup(final String token,
final User user, final Context ctx) {
final boolean isSecure = getConfiguration().getBoolean(
SETTING_KEY_VERIFICATION_LINK_SECURE);
final String url = routes.Signup.verify(token).absoluteURL(
ctx.request(), isSecure);
final Lang lang = Lang.preferred(ctx.request().acceptLanguages());
final String langCode = lang.code();
final String html = getEmailTemplate(
"views.html.account.email.verify_email", langCode, url, token,
user.name, user.email);
final String text = getEmailTemplate(
"views.txt.account.email.verify_email", langCode, url, token,
user.name, user.email);
return new Body(text, html);
}
示例4: getVerifyEmailMailingBody
import play.i18n.Lang; //导入方法依赖的package包/类
@Override
protected Body getVerifyEmailMailingBody(final String token,
final GSNUsernamePasswordAuthUser user, final Context ctx) {
final boolean isSecure = getConfiguration().getBoolean(
SETTING_KEY_VERIFICATION_LINK_SECURE);
final String url = controllers.gsn.auth.routes.Signup.verify(token).absoluteURL(
ctx.request(), isSecure);
final Lang lang = Lang.preferred(ctx.request().acceptLanguages());
final String langCode = lang.code();
final String html = getEmailTemplate(
"views.html.account.signup.email.verify_email", langCode, url,
token, user.getName(), user.getEmail());
final String text = getEmailTemplate(
"views.txt.account.signup.email.verify_email", langCode, url,
token, user.getName(), user.getEmail());
return new Body(text, html);
}
示例5: getPasswordResetMailingBody
import play.i18n.Lang; //导入方法依赖的package包/类
protected Body getPasswordResetMailingBody(final String token,
final User user, final Context ctx) {
final boolean isSecure = getConfiguration().getBoolean(
SETTING_KEY_PASSWORD_RESET_LINK_SECURE);
final String url = controllers.gsn.auth.routes.Signup.resetPassword(token).absoluteURL(
ctx.request(), isSecure);
final Lang lang = Lang.preferred(ctx.request().acceptLanguages());
final String langCode = lang.code();
final String html = getEmailTemplate(
"views.html.account.email.password_reset", langCode, url,
token, user.name, user.email);
final String text = getEmailTemplate(
"views.txt.account.email.password_reset", langCode, url, token,
user.name, user.email);
return new Body(text, html);
}
示例6: getVerifyEmailMailingBodyAfterSignup
import play.i18n.Lang; //导入方法依赖的package包/类
protected Body getVerifyEmailMailingBodyAfterSignup(final String token,
final User user, final Context ctx) {
final boolean isSecure = getConfiguration().getBoolean(
SETTING_KEY_VERIFICATION_LINK_SECURE);
final String url = controllers.gsn.auth.routes.Signup.verify(token).absoluteURL(
ctx.request(), isSecure);
final Lang lang = Lang.preferred(ctx.request().acceptLanguages());
final String langCode = lang.code();
final String html = getEmailTemplate(
"views.html.account.email.verify_email", langCode, url, token,
user.name, user.email);
final String text = getEmailTemplate(
"views.txt.account.email.verify_email", langCode, url, token,
user.name, user.email);
return new Body(text, html);
}
示例7: getVerifyEmailMailingBody
import play.i18n.Lang; //导入方法依赖的package包/类
@Override
protected Body getVerifyEmailMailingBody(final String token,
final MyUsernamePasswordAuthUser user, final Context ctx) {
final boolean isSecure = getConfiguration().getBoolean(
SETTING_KEY_VERIFICATION_LINK_SECURE);
final String url = routes.Signup.verify(token).absoluteURL(
ctx.request(), isSecure);
final Lang lang = Lang.preferred(ctx.request().acceptLanguages());
final String langCode = lang.code();
final String html = getEmailTemplate(
"views.html.common.account.signup.email.verify_email", langCode, url,
token, user.getName(), user.getEmail());
final String text = getEmailTemplate(
"views.txt.common.account.signup.email.verify_email", langCode, url,
token, user.getName(), user.getEmail());
return new Body(text, html);
}
示例8: getPasswordResetMailingBody
import play.i18n.Lang; //导入方法依赖的package包/类
protected Body getPasswordResetMailingBody(final String token,
final User user, final Context ctx) {
final boolean isSecure = getConfiguration().getBoolean(
SETTING_KEY_PASSWORD_RESET_LINK_SECURE);
final String url = routes.Signup.resetPassword(token).absoluteURL(
ctx.request(), isSecure);
final Lang lang = Lang.preferred(ctx.request().acceptLanguages());
final String langCode = lang.code();
final String html = getEmailTemplate(
"views.html.common.account.email.password_reset", langCode, url,
token, user.name, user.email);
final String text = getEmailTemplate(
"views.txt.common.account.email.password_reset", langCode, url, token,
user.name, user.email);
return new Body(text, html);
}
示例9: getVerifyEmailMailingBodyAfterSignup
import play.i18n.Lang; //导入方法依赖的package包/类
protected Body getVerifyEmailMailingBodyAfterSignup(final String token,
final User user, final Context ctx) {
final boolean isSecure = getConfiguration().getBoolean(
SETTING_KEY_VERIFICATION_LINK_SECURE);
final String url = routes.Signup.verify(token).absoluteURL(
ctx.request(), isSecure);
final Lang lang = Lang.preferred(ctx.request().acceptLanguages());
final String langCode = lang.code();
final String html = getEmailTemplate(
"views.html.common.account.email.verify_email", langCode, url, token,
user.name, user.email);
final String text = getEmailTemplate(
"views.txt.common.account.email.verify_email", langCode, url, token,
user.name, user.email);
return new Body(text, html);
}
示例10: getRoomInstruction
import play.i18n.Lang; //导入方法依赖的package包/类
private static String getRoomInstruction(ExamRoom room, Lang lang) {
String instructions;
switch (lang.code()) {
case "sv":
instructions = room.getRoomInstructionSV();
return instructions == null ? room.getRoomInstruction() : instructions;
case "en":
instructions = room.getRoomInstructionEN();
return instructions == null ? room.getRoomInstruction() : instructions;
case "fi":
default:
return room.getRoomInstruction();
}
}
示例11: getNumberFormat
import play.i18n.Lang; //导入方法依赖的package包/类
/**
* Return a number format matching the specified pattern.<br/>
* If the pattern is null then returns a format matching the current locale.
*
* @param pattern
* the pattern for the current locale
* @param signed
* set to true if the number must be always signed (display a +
* for positive numbers)
*
* @return a number format
*/
public static NumberFormat getNumberFormat(String pattern, Boolean signed) {
NumberFormat numberFormat;
if (pattern != null) {
numberFormat = (NumberFormat) Cache.get(IFrameworkConstants.FORMATS_CACHE_PREFIX + pattern);
if (numberFormat == null) {
String cacheKey = IFrameworkConstants.FORMATS_CACHE_PREFIX + pattern;
if (play.mvc.Http.Context.current.get() != null) {
Lang lang = Context.current().lang();
DecimalFormatSymbols decimalFormatSymbols = DecimalFormatSymbols.getInstance(lang.toLocale());
numberFormat = new DecimalFormat(pattern, decimalFormatSymbols);
cacheKey += "." + lang.code();
} else {
numberFormat = new DecimalFormat(pattern);
}
Cache.set(cacheKey, numberFormat, FORMATS_CACHING_DURATION);
}
} else if (play.mvc.Http.Context.current.get() != null) {
numberFormat = NumberFormat.getInstance(play.mvc.Http.Context.current().lang().toLocale());
} else {
numberFormat = NumberFormat.getInstance(Locale.getDefault());
}
if (signed) {
return new SignedNumberFormat(numberFormat);
} else {
return numberFormat;
}
}