Java Code Examples for play.i18n.Messages#get()
The following examples show how to use
play.i18n.Messages#get() .
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: GroovyTemplate.java From restcommander with Apache License 2.0 | 6 votes |
public String __getMessage(Object[] val) { if (val==null) { throw new NullPointerException("You are trying to resolve a message with an expression " + "that is resolved to null - " + "have you forgotten quotes around the message-key?"); } if (val.length == 1) { return Messages.get(val[0]); } else { // extract args from val Object[] args = new Object[val.length-1]; for( int i=1;i<val.length;i++) { args[i-1] = val[i]; } return Messages.get(val[0], args); } }
Example 2
Source File: Error.java From restcommander with Apache License 2.0 | 5 votes |
/** * @param key Alternate field name (default to java variable name) * @return The translated message */ public String message(String key) { key = Messages.get(key); Object[] args = new Object[variables.length + 1]; System.arraycopy(variables, 0, args, 1, variables.length); args[0] = key; return Messages.get(message, args); }
Example 3
Source File: JavaExtensions.java From restcommander with Apache License 2.0 | 5 votes |
public static String since(Date date, Boolean stopAtMonth) { Date now = new Date(); if (now.before(date)) { return ""; } long delta = (now.getTime() - date.getTime()) / 1000; if (delta < 60) { return Messages.get("since.seconds", delta, pluralize(delta)); } if (delta < 60 * 60) { long minutes = delta / 60; return Messages.get("since.minutes", minutes, pluralize(minutes)); } if (delta < 24 * 60 * 60) { long hours = delta / (60 * 60); return Messages.get("since.hours", hours, pluralize(hours)); } if (delta < 30 * 24 * 60 * 60) { long days = delta / (24 * 60 * 60); return Messages.get("since.days", days, pluralize(days)); } if (stopAtMonth) { return asdate(date.getTime(), Messages.get("since.format")); } if (delta < 365 * 24 * 60 * 60) { long months = delta / (30 * 24 * 60 * 60); return Messages.get("since.months", months, pluralize(months)); } long years = delta / (365 * 24 * 60 * 60); return Messages.get("since.years", years, pluralize(years)); }
Example 4
Source File: GSNUsernamePasswordAuthProvider.java From gsn with GNU General Public License v3.0 | 5 votes |
public String validate() { if (password == null || !password.equals(repeatPassword)) { return Messages .get("playauthenticate.password.signup.error.passwords_not_same"); } return null; }
Example 5
Source File: Account.java From gsn with GNU General Public License v3.0 | 5 votes |
public String validate() { if (password == null || !password.equals(repeatPassword)) { return Messages .get("playauthenticate.change_password.error.passwords_not_same"); } return null; }
Example 6
Source File: GSNUsernamePasswordAuthProvider.java From gsn with GNU General Public License v3.0 | 4 votes |
@Override protected String getVerifyEmailMailingSubject( final GSNUsernamePasswordAuthUser user, final Context ctx) { return Messages.get("playauthenticate.password.verify_signup.subject"); }
Example 7
Source File: GSNUsernamePasswordAuthProvider.java From gsn with GNU General Public License v3.0 | 4 votes |
protected String getPasswordResetMailingSubject(final User user, final Context ctx) { return Messages.get("playauthenticate.password.reset_email.subject"); }
Example 8
Source File: GSNUsernamePasswordAuthProvider.java From gsn with GNU General Public License v3.0 | 4 votes |
protected String getVerifyEmailMailingSubjectAfterSignup(final User user, final Context ctx) { return Messages.get("playauthenticate.password.verify_email.subject"); }