Java Code Examples for play.i18n.Lang#code()

The following examples show how to use play.i18n.Lang#code() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GSNUsernamePasswordAuthProvider.java    From gsn with GNU General Public License v3.0 6 votes vote down vote up
@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);
}
 
Example 2
Source File: GSNUsernamePasswordAuthProvider.java    From gsn with GNU General Public License v3.0 6 votes vote down vote up
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);
}
 
Example 3
Source File: GSNUsernamePasswordAuthProvider.java    From gsn with GNU General Public License v3.0 6 votes vote down vote up
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);
}