当前位置: 首页>>代码示例>>Java>>正文


Java Lang.code方法代码示例

本文整理汇总了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);
}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:22,代码来源:MyUsernamePasswordAuthProvider.java

示例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);
}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:21,代码来源:MyUsernamePasswordAuthProvider.java

示例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);
}
 
开发者ID:Vadus,项目名称:songs_play,代码行数:21,代码来源:MyUsernamePasswordAuthProvider.java

示例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);
}
 
开发者ID:LSIR,项目名称:gsn,代码行数:22,代码来源:GSNUsernamePasswordAuthProvider.java

示例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);
}
 
开发者ID:LSIR,项目名称:gsn,代码行数:21,代码来源:GSNUsernamePasswordAuthProvider.java

示例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);
}
 
开发者ID:LSIR,项目名称:gsn,代码行数:21,代码来源:GSNUsernamePasswordAuthProvider.java

示例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);
}
 
开发者ID:stefanil,项目名称:play2-prototypen,代码行数:22,代码来源:MyUsernamePasswordAuthProvider.java

示例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);
}
 
开发者ID:stefanil,项目名称:play2-prototypen,代码行数:21,代码来源:MyUsernamePasswordAuthProvider.java

示例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);
}
 
开发者ID:stefanil,项目名称:play2-prototypen,代码行数:21,代码来源:MyUsernamePasswordAuthProvider.java

示例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();
    }
}
 
开发者ID:CSCfi,项目名称:exam,代码行数:15,代码来源:EmailComposerImpl.java

示例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;
    }
}
 
开发者ID:theAgileFactory,项目名称:app-framework,代码行数:49,代码来源:Utilities.java


注:本文中的play.i18n.Lang.code方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。