1 package com.atlassian.sal.api.message;
2
3 import javax.servlet.http.HttpServletRequest;
4 import java.util.Locale;
5 import java.util.Set;
6
7 /**
8 * This interface is responsible for resolving the current locale.
9 *
10 * @since 2.0
11 */
12 public interface LocaleResolver
13 {
14 /**
15 * Given a request, resolve the {@link Locale} that should be used in internationalization and localization.
16 * The locale should be determined by first checking the remote users preferences, then defaulting to the
17 * application default locale if no preferred locale is set.
18 *
19 * @param request Request to check
20 * @return Locale to be used in i18n and l10n. {@link Locale#getDefault()} if none found.
21 */
22 Locale getLocale(HttpServletRequest request);
23
24 /**
25 * Returns a set of all the supported locales by the host application. This is all the language packs that
26 * are installed.
27 *
28 * @return an unmodifiable set of all the supported locales by the host application. Must contain at least one locale.
29 */
30 Set<Locale> getSupportedLocales();
31 }