<commit_before>h1. Grails Locale Configuration Plugin
[Grails Locale Configuration Plugin|https://github.com/stokito/grails-locale-configuration-plugin] enhances the handling of Grails localization (i18n).

This plugin is intended to enhance the language support in Grails by detecting your users’ locale and selecting the most appropriate language for them.
You can specify a list of supported languages and choose which language to use if a client’s preferred language is not available.

For example, if your site supports only English, Russian and German, you can send users with other locales to the default language (English).

h2. Installation
Please add the following repository and dependency to your BuildConfig.groovy:
{code}
grails.project.dependency.resolution = {
    plugins {
        ...
        compile ':locale-configuration:1.0'
        ...
    }
}
{code}

h2. Configuration
Add the following lines to your Config.groovy.
{code}
// order is matters!
grails.plugins.localeConfiguration.supportedLocales = [Locale.GERMAN, Locale.ENGLISH]
grails.plugins.localeConfiguration.defaultLocale = Locale.ENGLISH
{code}

h2. Locales priority
# Language Param in the URL (request), e.g. http://www.example.net?lang=en
# First match of the locales from the HTTP Accept-Language header
# Default locale (defaultLocale option in Config.groovy)

{note}
This order is important and cannot be changed. You may want to provide a language selector, so the lang param should have the highest priority.
{note}

[Take a look into specification for more details|https://github.com/stokito/grails-locale-configuration-plugin/blob/master/test/unit/name/stokito/SmartConfigLocaleResolverSpec.groovy]

h2. Running application example
Take a look at the demo to see the plugin in action: [Grails Locale Configuration Plugin demo application|https://github.com/stokito/grails-locale-configuration-plugin-demo]

{note}
If you want to test your locales (languages), just add the locales to the Config.groovy as described in 'Configuration'.
{note}

Run demo, like every other Grails application
{code}
    grails run-app
{code}

Application can be accessed by URL http://localhost:8080/

h2. Support
For any questions feel free to contact me:

 * <EMAIL>
 * skype: stokito
 * [<NAME>|http://stokito.wordpress.com/]
 * [LinkedIn|https://linkedin.com/in/stokito]

Thanks to [<NAME>|https://github.com/jigsawIV] for contribution!<commit_msg>README.wiki<commit_after>h1. Grails Locale Configuration Plugin
[Grails Locale Configuration Plugin|https://github.com/stokito/grails-locale-configuration-plugin] enhances the handling of Grails localization (i18n).

This plugin is intended to enhance the language support in Grails by detecting your users’ locale and selecting the most appropriate language for them.
You can specify a list of supported languages and choose which language to use if a client’s preferred language is not available.

For example, if your site supports only English, Russian and German, you can send users with other locales to the default language (English).

h2. Installation
Please add the following repository and dependency to your BuildConfig.groovy:
{code}
grails.project.dependency.resolution = {
    plugins {
        ...
        compile ':locale-configuration:1.0'
        ...
    }
}
{code}

h2. Configuration
Add the following lines to your Config.groovy.
{code}
// order is matters!
grails.plugins.localeConfiguration.supportedLocales = [Locale.GERMAN, Locale.ENGLISH]
grails.plugins.localeConfiguration.defaultLocale = Locale.ENGLISH
{code}

h2. Locales priority
# Language Param in the URL (request), e.g. http://www.example.net?lang=en
# First match of the locales from the HTTP Accept-Language header
# Default locale (defaultLocale option in Config.groovy)

{note}
This order is important and cannot be changed. You may want to provide a language selector, so the lang param should have the highest priority.
{note}

[Take a look into specification for more details|https://github.com/stokito/grails-locale-configuration-plugin/blob/master/test/unit/name/stokito/SmartConfigLocaleResolverSpec.groovy]

h2. Running application example
Take a look at the demo to see the plugin in action: [Grails Locale Configuration Plugin demo application|https://github.com/stokito/grails-locale-configuration-plugin-demo]

{note}
If you want to test your locales (languages), just add the locales to the Config.groovy as described in 'Configuration'.
{note}

Run demo, like every other Grails application
{code}
    grails run-app
{code}

Then application can be accessed by URL [http://localhost:8080/grails-locale-configuration-plugin-demo/]

h2. Support
For any questions feel free to contact me:

 * <EMAIL>
 * skype: stokito
 * [<NAME>|http://stokito.wordpress.com/]
 * [LinkedIn|https://linkedin.com/in/stokito]

Thanks to [<NAME>|https://github.com/jigsawIV] for contribution!
{'fraction_non_alphanumeric': 0.0850194154915185, 'fraction_numerical': 0.005722460658082976, 'mean_word_length': 4.5995423340961095, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '44330', 'n_tokens_mistral': 1394, 'n_tokens_neox': 1343, 'n_words': 532}