當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。