@Override
public void supply(Map<String, Object> data)
{
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);
}