{% extends "../../layout.html" %} {% block sectionClasses %}plugins hasBreadCrumb plugins-spincast-locale-resolver{% endblock %} {% block meta_title %}Plugins - Spincast Locale Resolver{% endblock %} {% block meta_description %}Spincast Locale Resolver plugin helps find the Locale/Langage to use.{% endblock %} {% block scripts %} {% endblock %} {% block body %}
This plugin provides an implementation of the LocaleResolver interface, which is used to find the best locale/language to use in the code. The implementation, LocaleResolverDefault, tries to find the best Locale to use this way :
"Accept-Language" HTTP header of the current request to determine the best Locale to use.
Locale to use
inside a Route Handler :
public void myHandler(AppRequestContext context) {
Locale localeToUse = context.getLocaleToUse();
//...
}
If you use the spincast-default artifact and the standard Bootstrapper,
this plugin is already installed by default so you have nothing to do!
If you start from scratch, using the spincast-core artifact, you can use the
plugin by :
1. Adding this Maven artifact to your project:
<dependency>
<groupId>org.spincast</groupId>
<artifactId>spincast-plugins-locale-resolver</artifactId>
<version>{{spincast.spincastCurrrentVersion}}</version>
</dependency>
2. Installing the provided SpincastLocaleResolverPluginModule module to your Guice context.
The class implementing the SpincastPlugin interface is SpincastLocaleResolverPlugin.