All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.plugins.spincast-locale-resolver.spincast-locale-resolver.html Maven / Gradle / Ivy

{#==========================================
Spincast Locale Resolver plugin
==========================================#}
{% extends "../../layout.html" %}

{% block sectionClasses %}plugins 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 %}

Overview

The Spincast Locale Resolver plugin provides an implementation of the ILocaleResolver interface, which is used to find the best locale/language to use for the current request/response exchange.

Installation

If you use the spincast-default artifact, this plugin is already installed so you have nothing more to do!

If you start from scratch using the spincast-core artifact, you can use the plugin by adding this artifact to your project:

<dependency>
    <groupId>org.spincast</groupId>
    <artifactId>spincast-plugins-locale-resolver</artifactId>
    <version>{{spincastCurrrentVersion}}</version>
</dependency>

You then install the plugin's Guice module, by passing it to the Guice.createInjector(...) method:

Injector guice = Guice.createInjector(
        new SpincastCoreGuiceModule(args),
        new SpincastLocaleResolverPluginGuiceModule(IAppRequestContext.class)
        // other modules...
        );

... or by using the install(...) method from your custom Guice module:

public class AppModule extends SpincastCoreGuiceModule {

    @Override
    protected void configure() {
        super.configure();
        install(new SpincastLocaleResolverPluginGuiceModule(getRequestContextType()));
        // other modules...
    }
    
    // ...
}

The ILocaleResolver interface

Methods :

  • Locale getLocaleToUse()
    The best Locale to use.
    @return The best Locale to use. If none is found, returns the default Locale, as defined by ISpincastConfig#getDefaultLocale()

{% endblock %}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy