private Locale getTenantDefaultLocale() { return context.getSettings(GeneralSettings.class).getLocales().getMainLocale().getValue(); } }
@GET public Response listLocales() { List<Locale> locales; Map<String, String> endpoints = Maps.newHashMap(); GeneralSettings settings = context.getSettings(GeneralSettings.class); locales = settings.getLocales().getOtherLocales().getValue(); locales.add(settings.getLocales().getMainLocale().getValue()); for (Locale locale : locales) { endpoints.put(locale.toLanguageTag(), "/api/localization/theme/" + locale.toLanguageTag()); } return Response.ok(endpoints).build(); }
FluentIterable.from(localesSettings.getOtherLocales().getValue()) .filter(Predicates.notNull()).toList();
@GET @Path(PAYMENT_RETURN_PATH + "/{order}") public WebView returnFromPaymentService(@Context UriInfo uriInfo, @PathParam("order") String orderId) { Map<String, Object> bindings = new HashMap<>(); if (StringUtils.isNotBlank(orderId)) { Order order = orderStore.get().findById(UUID.fromString(orderId)); if (order != null) { Optional<Address> da = order.getDeliveryAddress() != null ? Optional.fromNullable(order.getDeliveryAddress()) : Optional.<Address>absent(); Optional<Address> ba = order.getBillingAddress() != null ? Optional.fromNullable(order.getBillingAddress()) : Optional.<Address>absent(); bindings.putAll( prepareContext(order, order.getCustomer(), ba, da, webContext.getTenant(), configurationService.getSettings(GeneralSettings.class).getLocales().getMainLocale() .getValue())); } } return new WebView().template("checkout/success.html").with(WebView.Option.FALLBACK_ON_DEFAULT_THEME) .data(bindings); }
@Override public void supply(Map<String, Object> data) { // Manage list of locales and corresponding links String path = context.getRequest().getCanonicalPath(); Map<String, Map<String, String>> locales = Maps.newHashMap(); GeneralSettings settings = context.getSettings(GeneralSettings.class); final Locale mainLocale = settings.getLocales().getMainLocale().getValue(); locales.put(mainLocale.toLanguageTag(), buildLocale(mainLocale, path, true)); List<Locale> alternativeLocales = FluentIterable.from(settings.getLocales().getOtherLocales().getValue()).filter(Predicates.notNull()) .toList(); if (!alternativeLocales.isEmpty()) { for (final Locale locale : alternativeLocales) { locales.put(locale.toLanguageTag(), buildLocale(locale, path, false)); } } data.put("locales", locales); data.put("locale", buildLocale(context.getLocale(), path, mainLocale.equals(context.getLocale()))); data.put("localePath", context.isAlternativeLocale() ? ("/" + context.getLocale().toLanguageTag()) : ""); data.put("url", data.get("localePath") + path); data.put("canonicalUrl", path); }
context.getSettings(GeneralSettings.class).getLocales().getMainLocale().getValue(); file = getForLanguageTag(defaultLocale.toLanguageTag()); if (!file.isPresent() && !defaultLocale.getCountry().equals("")) {
boolean localeSet = false; List<Locale> alternativeLocales = FluentIterable.from(localesSettings.getOtherLocales().getValue()) .filter(Predicates.notNull()).toList(); context.setLocale(localesSettings.getMainLocale().getValue()); context.setAlternativeLocale(false);
/** * @see {@link org.xwiki.observation.EventListener#onEvent(org.xwiki.observation.event.Event, Object, Object)} */ public void onEvent(Event event, Object source, Object data) { GeneralSettings settings = configurationService.getSettings(GeneralSettings.class); final Order order = (Order) source; final Locale customerLocale = webContext.getLocale(); final Tenant tenant = webContext.getTenant(); final Locale tenantLocale = settings.getLocales().getMainLocale().getValue(); final boolean withInvoice = invoicingService.isEnabledInContext(); Executors.newSingleThreadExecutor().submit(new Callable<Void>() { @Override public Void call() throws Exception { sendNotificationMails(order, tenant, customerLocale, tenantLocale, withInvoice); return null; } }); }
Optional.fromNullable(response.getOrder().getDeliveryAddress()), webContext.getTenant(), configurationService.getSettings(GeneralSettings.class).getLocales().getMainLocale().getValue()
final InvoicingSettings invoicingSettings = configurationService.getSettings(InvoicingSettings.class, tenant); final Locale locale = settings.getLocales().getMainLocale().getValue();