Refine search
@Override protected String load() { return Application.get() .getResourceSettings() .getLocalizer() .getString(resourceKey, component, null, null, null, defaultValue); }
/** * Clears the i18n cache so that localized keys can be reloaded. * * <p> * Have hidden this service because it seems that Wicket automatically invalidates * the resource cache anyway if running in development/prototype mode. * </p> */ @Action( restrictTo = RestrictTo.PROTOTYPING, hidden = Where.EVERYWHERE, semantics = SemanticsOf.IDEMPOTENT ) public void resetI18nCache() { Application.get() .getResourceSettings() .getLocalizer().clearCache(); } }
public Localizer getLocalizer() { if (localizer == null) { localizer = new Localizer(); } return localizer; }
/** * @see org.apache.wicket.model.AbstractReadOnlyModel#getObject() */ public Object getObject() { return Application.get().getResourceSettings().getLocalizer().getString(resourceKey, component, defaultValue); }
/** * Clears the i18n cache so that localized keys can be reloaded. * * <p> * Have hidden this service because it seems that Wicket automatically invalidates * the resource cache anyway if running in development/prototype mode. * </p> */ @Action( restrictTo = RestrictTo.PROTOTYPING, hidden = Where.EVERYWHERE, semantics = SemanticsOf.IDEMPOTENT ) public void resetI18nCache() { Application.get() .getResourceSettings() .getLocalizer().clearCache(); } }
final String defaultValue) throws MissingResourceException final IResourceSettings resourceSettings = Application.get().getResourceSettings(); cacheKey = getCacheKey(key, component); string = getFromCache(cacheKey); putIntoCache(cacheKey, string); return substitutePropertyExpressions(component, string, model);
private String getString(Localizer localizer, String key, Component component) { triedKeys.add(key); return localizer.getString(key, component, ""); }
public static String getString(OrienteerWebApplication app, String key, Locale locale) { return app.getResourceSettings().getLocalizer().getString(key, null, null, locale, null, ""); }
/** * @see org.apache.wicket.jmx.ApplicationMBean#clearLocalizerCache() */ @Override public void clearLocalizerCache() throws IOException { application.getResourceSettings().getLocalizer().clearCache(); } }
/** * @see org.apache.wicket.resource.IPropertiesFactory#clearCache() */ public final void clearCache() { propertiesCache.clear(); // clear the localizer cache as well application.getResourceSettings().getLocalizer().clearCache(); }
/** Clears all the wicket caches so that resources and localization files will be re-read */ public void clearWicketCaches() { getResourceSettings().getPropertiesFactory().clearCache(); getResourceSettings().getLocalizer().clearCache(); }
private void invalidateCache() { OrienteerWebApplication app = OrienteerWebApplication.lookupApplication(); if(app!=null) { app.getResourceSettings().getLocalizer().clearCache(); } }
cacheKey = getCacheKey(key, component); value = getFromCache(cacheKey); if (log.isDebugEnabled()) Iterator<IStringResourceLoader> iter = getStringResourceLoaders(); while (iter.hasNext()) putIntoCache(cacheKey, value); return substitutePropertyExpressions(component, value, model);
/** * @see org.apache.wicket.resource.IPropertiesFactory#clearCache() */ @Override public final void clearCache() { if (propertiesCache != null) { propertiesCache.clear(); } // clear the localizer cache as well context.getLocalizer().clearCache(); }
/** * @see org.apache.wicket.model.AbstractReadOnlyModel#getObject() */ @Override public String getObject() { // this shouldn't be called always wrapped! return Application.get().getResourceSettings().getLocalizer().getString(resourceKey, (Component)null, defaultValue); }
/** * @param key * The resource key * @param model * The model * @return The formatted string * @see Localizer */ public final String getString(final String key, final IModel<?> model) { return getLocalizer().getString(key, this, model); }
/** * Asserts that there is a feedback message provided by a given component * * @param component * the component that provided the expected feedback message. Optional. * @param key * the resource key for the feedback message. Mandatory. * @param model * the model used for interpolating the feedback message. Optional. * @param filter * the filter that decides in which messages to look in. E.g. with a specific * level, rendered or not, etc. */ public void assertComponentFeedbackMessage(Component component, String key, IModel<?> model, IFeedbackMessageFilter filter) { Args.notNull(key, "key"); String expectedMessage = getApplication().getResourceSettings().getLocalizer().getString(key, component, model); List<FeedbackMessage> feedbackMessages = getFeedbackMessages(filter); List<Serializable> actualMessages = getActualFeedbackMessages(feedbackMessages); assertTrue(String.format("Feedback message with key '%s' cannot be found in %s", key, actualMessages), actualMessages.contains(expectedMessage)); }
public void onChange() { log.info("A properties files has changed. Removing all entries " + "from the cache. Resource: " + resourceStream); // Clear the whole cache as associated localized files may // be affected and may need reloading as well. clearCache(); // clear the localizer cache as well application.getResourceSettings().getLocalizer().clearCache(); // Inform all listeners Iterator iter = afterReloadListeners.iterator(); while (iter.hasNext()) { IPropertiesChangeListener listener = (IPropertiesChangeListener)iter.next(); try { listener.propertiesChanged(key); } catch (Throwable ex) { log.error("PropertiesReloadListener has thrown an exception: " + ex.getMessage()); } } } });
cacheKey = getCacheKey(key, component, locale, style, variation); value = getFromCache(cacheKey); if (log.isDebugEnabled()) Iterator<IStringResourceLoader> iter = getStringResourceLoaders().iterator(); value = null; while (iter.hasNext() && (value == null)) putIntoCache(cacheKey, value); return substitutePropertyExpressions(component, value, model);
/** * @see org.apache.wicket.resource.IPropertiesFactory#clearCache() */ @Override public final void clearCache() { if (propertiesCache != null) { propertiesCache.clear(); } // clear the localizer cache as well context.getLocalizer().clearCache(); }