/** * @see org.apache.velocity.tools.generic.ResourceTool#get(java.lang.Object, java.lang.String[], * java.lang.Object) */ @Override public Object get(Object code, String[] resourceNamePrefixes, Object locale) { Object msg = super.get(code, resourceNamePrefixes, locale); //if code's translation is blank, use the english equivalent if (msg == null || StringUtils.isBlank(msg.toString())) { msg = super.get(code, resourceNamePrefixes, Locale.ENGLISH.toString()); } return msg; } }
public Object getRaw() { if (!this.cached) { this.rawValue = ResourceTool.this.get(this.key, this.bundles, this.locale); this.cached = true; } return this.rawValue; }
/** * Accepts objects and uses their string value as the key. * @param k key * @return Key object */ public Key get(Object k) { String key = k == null ? null : String.valueOf(k); return get(key); }
/** * Retrieve a resource for the specified key from the first of the * specified bundles in which a matching resource is found. * If no resource is found, no exception will be thrown and {@code null} * will be returned. * * @param k the key for the requested resource * @param bundles the resource bundles to search * @param l the locale to use * @return value */ public Object get(Object k, String[] bundles, Object l) { String key = k == null ? null : String.valueOf(k); for (int i=0; i < bundles.length; i++) { Object resource = get(key, bundles[i], l); if (resource != null) { return resource; } } return null; }