private static boolean customResourceExists(final String packageResourcePath, final Session session) { final String customResourceKey = packageResourcePath + session.getLocale() + session.getStyle(); if (!customPackageResourceExists.containsKey(customResourceKey)) { Boolean resourceExists = PackageResource.exists(BrowserStyle.class, packageResourcePath, session.getLocale(), session.getStyle(), null); customPackageResourceExists.put(customResourceKey, resourceExists); return resourceExists; } else { return customPackageResourceExists.get(customResourceKey); } }
@Override public Object getDisplayValue(String object) { if(TEMPLATE_ID.equals(object)) return "Template"; Locale locale = (Locale) PropertiesFactory.eINSTANCE.createFromString(PropertiesPackage.Literals.LOCALE, object); String displayName = locale == null ? "Template" : locale.getDisplayName(getSession().getLocale()); return displayName; }
private static Language selectLang() { try { return Language.valueOf(Session.get().getLocale().getLanguage()); } catch (IllegalArgumentException e) { return null; } }
private static Language selectLang() { try { return Language.valueOf(Session.get().getLocale().getLanguage()); } catch (IllegalArgumentException e) { return null; } }
private Locale getCurrentLocale() { if (locale == null && Session.exists()) { return Session.get().getLocale(); } return locale; }
private Locale getCurrentLocale() { if (locale == null && Session.exists()) { return Session.get().getLocale(); } return locale; }
private Locale getLocale() { return Session.exists() ? Session.get().getLocale() : null; } }
/** * @return human readable string of bytes uploaded so far */ public String getBytesUploadedString() { return Bytes.bytes(bytesUploaded).toString(Session.get().getLocale()); }
/** * @return human readable string of total number of bytes */ public String getTotalBytesString() { return Bytes.bytes(totalBytes).toString(Session.get().getLocale()); }
/** * @return human readable string of bytes uploaded so far */ public String getBytesUploadedString() { return Bytes.bytes(bytesUploaded).toString(Session.get().getLocale()); }
/** * @return human readable string of total number of bytes */ public String getTotalBytesString() { return Bytes.bytes(totalBytes).toString(Session.get().getLocale()); }
private Locale getCurrentLocale() { final Locale locale = getLocale(); if (locale != null) { return locale; } if (Session.exists()) { return Session.get().getLocale(); } return locale; }
private Properties fetchChannelResources(final Channel channel) throws ChannelException { log.info("Fetching i18n resources for channel '{}'", channel.getId()); final ChannelService channelService = getRestProxy(channel).createSecureRestProxy(ChannelService.class); final String locale = Session.get().getLocale().toString(); return channelService.getChannelResourceValues(channel.getId(), locale); }
/** * @return transfer rate in a human readable string */ public String getTransferRateString() { return Bytes.bytes(getTransferRateBPS()).toString(Session.get().getLocale()) + "/s"; }
/** * @return estimate of the remaining time in a human readable string */ public String getRemainingTimeString() { return Duration.milliseconds(getRemainingMilliseconds()) .toString(Session.get().getLocale()); }
/** * @return transfer rate in a human readable string */ public String getTransferRateString() { return Bytes.bytes(getTransferRateBPS()).toString(Session.get().getLocale()) + "/s"; }
/** * Get a new {@link PropertyResolverConverter} * * @return a new {@code PropertyResolverConverter} */ protected PropertyResolverConverter newPropertyResolverConverter() { return new PropertyResolverConverter(Application.get().getConverterLocator(), Session.get().getLocale()); }
/** * @return estimate of the remaining time in a human readable string */ public String getRemainingTimeString() { return Duration.milliseconds(getRemainingMilliseconds()) .toString(Session.get().getLocale()); }
public DatePicker(final ResourceReference icon) { super( SpecialKeys.specialKeysJs, uiDatepickerJs ); addCssResources(getCssResources()); Locale locale = Session.get().getLocale(); if (locale != null) addUserProvidedResourceReferences(new JQueryJavascriptResourceReference(DatePicker.class, "jquery.ui.datepicker-" + locale.getLanguage() + ".js")); if (icon != null) setButtonImage(icon); setRestoreAfterRedraw(true); }
private String getStringFromBundle(final String key) { final LocalizationService service = HippoServiceRegistry.getService(LocalizationService.class); if (service != null) { final ResourceBundle bundle = service.getResourceBundle(getBundleName(), Session.get().getLocale()); if (bundle != null) { return bundle.getString(key); } } return null; }