com.github.pmairif.weberknecht.i18n.Localizable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weberknecht Show documentation
Show all versions of weberknecht Show documentation
Yet another java web framework that wants to make web developers life a bit easier.
/*
* Localizable.java (weberknecht)
*
* Copyright 2013 Patrick Mairif.
* The program is distributed under the terms of the Apache License (ALv2).
*
* tabstop=4, charset=UTF-8
*/
package com.github.pmairif.weberknecht.i18n;
import java.util.Locale;
import java.util.ResourceBundle;
import com.github.pmairif.weberknecht.request.routing.LocalePrefixRouter;
/**
* Actions implementing this interface will get the requested locale via the {@link LocalePrefixRouter} or a similar router.
*
* The locale, that will be set is not the locale extracted from the 'Accept-Language' header, it is extracted from the URL.
* It's up to the action to decide which one to use. A good practice is to use that from the URL, if present.
* If not, choose a locale based on the header via the mechanism from {@link ResourceBundle} and redirect to an URL containing
* the chosen language. {@link LocaleMatcher} provides some helpful methods.
*
* @author pmairif
*/
public interface Localizable {
/**
* set the locale extracted from the requested URL, if present.
*
* @param requestedLocale the locale or null
*/
public void setRequestedLocale(Locale requestedLocale);
}