Code Monkey home page Code Monkey logo

laravel-tongue's Introduction

Laravel Tongue 👅 - Multilingual subdomain URLs and redirects

Build Status styleci Scrutinizer Code Quality Coverage Status

Packagist Packagist Packagist

Laravel Tongue

If you are looking for an easy package for subdomain multilingual URLs, this package is for you. 😜

Old Way: https://example.com/de, https://example.com/fr etc.
New Way: https://de.example.com, https://fr.example.com etc.

*Prerequisites: PHP ^7.4 || ^8.1 and Laravel ^8.41 || PHP ^8.0.2 and Laravel ^9.0 and Laravel ^10.0 *Older Laravel Versions: Click here

Installation in 4 Steps*

1: Add with composer 💻

  composer require pmochine/laravel-tongue

2: Publish Configuration File (you need to change some things to use it 😎)

  php artisan vendor:publish --provider="Pmochine\LaravelTongue\ServiceProvider" --tag="config"

3: Add the Middleware 🌐

Laravel Tongue comes with a middleware that can be used to enforce the use of a language subdomain. For example the user calls example.com it goes directly to fr.example.com.

If you want to use it, open app/Http/kernel.php and register this route middleware by adding it to the routeMiddleware (down below) array:

  ...
  'speaks-tongue' => \Pmochine\LaravelTongue\Middleware\TongueSpeaksLocale::class,
  ...

4: Add in your Env 🔑

  APP_DOMAIN=yourdomain.com #Only important for domains with many dots like: '155ad73e.eu.ngrok.io'
  SESSION_DOMAIN=.yourdomain.com #Read down below why

Important! Note the dot before the domain name. Now the session is available in every subdomain 🙃. This is important because you want to save all your cookie 🍪 data in one place and not in many other.

*Note! 📝 This step is optional if you use laravel>=5.5 with package auto-discovery feature. Add service provider to config/app.php in providers section

   Pmochine\LaravelTongue\ServiceProvider::class,

Usage - (or to make it runnable 🏃‍♂️)

Locale detection 🔍

Open app/Providers/RouteServiceProvider.php and add this

  public function boot()
  {
      // This will guess a locale from the current HTTP request
      // and set the application locale.
      tongue()->detect();
      
      //If you use Carbon you can set the Locale right here.
      \Carbon\Carbon::setLocale(tongue()->current()); 
      
      parent::boot();
  }
  ...

Once you have done this, there is nothing more that you MUST do. Laravel application locale has been set and you can use other locale-dependent Laravel components (e.g. Translation) as you normally do.

Middleware 🌐

If you want to enforce the use of a language subdomain for some routes, you can simply assign the middleware provided, for example as follows in routes/web.php:

  // Without the localize middleware, this route can be reached with or without language subdomain
  Route::get('logout', 'AuthController@logout');
  
  // With the localize middleware, this route cannot be reached without language subdomain
  Route::group([ 'middleware' => [ 'speaks-tongue' ]], function() {
  
      Route::get('welcome', 'WelcomeController@index');
  
  });

For more information about Middleware, please refer to Laravel docs.

Frontend 😴

  <!doctype html>
  <html lang="{{tongue()->current()}}" dir="{{tongue()->leftOrRight()}}">

    <head>
      @include('layouts.head')
    </head>

    <body>
    ...

The above <html> tag will always have a supported locale and directionality (‘ltr’ or ‘rtl’). The latter is important for right-to-left languages like Arabic and Hebrew since the whole page layout will change for those.

Configuration

Once you have imported the config file, you will find it at config/localization.php.

Important: Before you start changing the values, you still need to set the "main language" of your page. If your main language is fr, please add this to your config/app.php file under 'fallback_locale' => 'fr',.

We asume that your fallback language has always translated pages. We get the current locale via four ways:

  1. First we determine the local with the subdomain of the URL the user is coming from

If there is no subdomain added, we get the locale from:

  1. an already set language cookie
  2. or the browsers prefered language
  3. or at the end we fall back to the fallback_locale

Note: The value locale in config/app.php has no impact and is going to overwritten by tongue()->detect(); in app/Providers/RouteServiceProvider.php

Configuration values

  • domain (default: null)

You don't need to worry about this, only when you are using domains with multiple dots, like: 155ad73e.eu.ngrok.io. Without it, we cannot check what your subdomain is.

  • beautify_url (default: true)

Makes the URL BEAUTIFUL 💁‍♀️. ( Use to set fallback language to mydomain.com and not to en.mydomain.com). That is why I even created this package. I just could not find this! 😭

  • subdomains (default: [])

Sometimes you would like to have your admin panel as a subdomain URL. Here you can whitelist those subdomains (only important if those URLs are using the middleware).

  • aliases (default: []) Sometimes you would like to specify aliases to use custom subdomains instead of locale codes. For example:
  gewinnen.domain.com --> "de"
  gagner.domain.com --> "fr",
  • acceptLanguage (default: true)

Use this option to enable or disable the use of the browser 💻 settings during locale detection.

  • cookie_localization (default: true)

Use this option to enable or disable the use of cookies 🍪 during the locale detection.

  • cookie_serialize (default: false)

If you have not changed anything in your middleware "EncryptCookies", you don't need to change anything here as well. More

  • prevent_redirect (default: false)

Important for debugging, when you want to deactivate the middleware speaks-tongue.

  • supportedLocales (default: 🇬🇧🇩🇪🇪🇸🇫🇷🇭🇺)

Don't say anyone that I copied it from mcamara 🤫

Route translation

If you want to use translated routes (en.yourdomain.com/welcome, fr.yourdomain.com/bienvenue), proceed as follows:

First, create language files for the languages that you support:

resources/lang/en/routes.php:

  return [
    
    // route name => route translation
    'welcome' => 'welcome',
    'user_profile' => 'user/{username}',
  
  ];

resources/lang/fr/routes.php:

  return [
    
    // route name => route translation
    'welcome' => 'bienvenue',
    'user_profile' => 'utilisateur/{username}',
    
  ];

Then, here is how you define translated routes in routes/web.php:

  Route::group([ 'middleware' => [ 'speaks-tongue' ]], function() {
    
      Route::get(dialect()->interpret('routes.welcome'), 'WelcomeController@index');
    
  });

You can, of course, name the language files as you wish, and pass the proper prefix (routes. in the example) to the interpret() method.

Helper Functions - (finally something useful 😎)

This package provides useful helper functions that you can use - for example - in your views:

Translate your current URL into the given language

  <a href="{{ dialect()->current('fr') }}">See the french version</a>

Get all translated URL except the current URL

  @foreach (dialect()->translateAll(true) as $locale => $url)
      <a href="{{ $url }}">{{ $locale }}</a>
  @endforeach

You can pass false as parameter so it won't exclude the current URL.

Translate URL to the language you want

  <a href="{{ dialect()->translate('routes.user_profile', [ 'username' => 'JohnDoe' ], 'fr') }}">See JohnDoe's profile</a>
  // Result: https://fr.example.com/utilisateur/JohnDoe 

Remember: Set the translation in the lang folder

Use dialect()->translate($routeName, $routeAttributes = null, $locale = null) to generate an alternate version of the given route. This will return an URL with the proper subdomain and also translate the URI if necessary.

You can pass route parameters if necessary. If you don't give a specific locale, it will use the current locale ☺️.

Redirect URL to the language you want

  <a href="{{ dialect()->redirectUrl(route('home'), 'fr') }}">See Homepage in French</a>
  // Result: https://fr.example.com 

Use dialect()->redirectUrl($url = null, $locale = null); to redirect for example to the same URL but in different locale. Warning: Works only when the paths are not translated. Use dialect()->translate() for that.

Get your config supported locale list

  $collection = tongue()->speaking(); //returns collection

Remember it returns a collection. You can add methods to it (see available methods) Examples:

  $keys = tongue()->speaking()->keys()->all(); //['en','de',..]
  $sorted = tongue()->speaking()->sort()->all(); //['de','en',..]

Additionally, you can even get some addtional information:

  tongue()->speaking('BCP47', 'en'); // en-GB
  tongue()->speaking('subdomains'); // ['admin']
  tongue()->speaking('subdomains', 'admin'); // true
  tongue()->speaking('aliases'); // ['gewinnen' => 'de', 'gagner' => 'fr]
  tongue()->speaking('aliases', 'gewinnen'); //' de'

Get the current language that is set

  $locale = tongue()->current(); //de

Or if you like you can get the full name, the alphabet script, the native name of the language & the regional code.

  $name = tongue()->current('name'); //German
  $script = tongue()->current('script'); //Latn
  $native = tongue()->current('native'); //Deutsch
  $regional = tongue()->current('regional'); //de_DE

How to Switch Up the Language 🇬🇧->🇩🇪

For example with a selector:

  <ul>
      @foreach(tongue()->speaking()->all() as $localeCode => $properties)
          <li>
              <a rel="alternate" hreflang="{{ $localeCode }}" href="{{ dialect()->current($localeCode) }}">
                  {{ $properties['native'] }}
              </a>
          </li>
      @endforeach
  </ul>

Or in a controller far far away...

  /**
   * Sets the locale in the app
   * @return redirect to previous url
   */
  public function store()
  {
    $locale = request()->validate([
      'locale' => 'required|string|size:2'
    ])['locale'];

    return tongue()->speaks($locale)->back();
  } 

Upgrade Guide 🎢

Upgrade to 2.x.x from 1.x.x

There are little changes that might be important for you.

  • We added two new config elements in localization. domain and aliases. Add these like here.
  • Add APP_DOMAIN in your .env if you have a complicated domain, like: 155ad73e.eu.ngrok.io
  • Now you are able to use aliases in your subdomain. For example: gewinnen.domain.com --> "de"
  • If a subdomain is invalid, it returns to the latest valid locale subdomain.

Support for Laravel 9.x.x

If you want to use:

PHP <=8.0 and Laravel 9.x.x

you need to download the version 4.0.0.

  composer require pmochine/laravel-tongue:4.0.0

Support for Laravel 7.22.0 up to Laravel 8.41.0

If you want to use:

PHP >=7.3 and at least 7.22.0 <= Laravel <=8.41.0

you need to download the version 3.0.0.

  composer require pmochine/laravel-tongue:3.0.0

Support for Laravel 6.x.x up to Laravel 7.21.0

If you want to use:

PHP >=7.2 and at least 6.x.x <= Laravel <=7.21.0

you need to download the version 2.2.1 or lower.

  composer require pmochine/laravel-tongue:2.2.1

Support for Laravel 5.x.x

If you want to use:

PHP >=7.0 and at least 5.4 <= Laravel <=5.8

you need to download the version 2.0.0 or lower.

  composer require pmochine/laravel-tongue:2.0.0

Security

If you discover any security related issues, please don't email me. I'm afraid 😱. [email protected]

Credits

Now comes the best part! 😍 This package is based on

Oh come on. You read everything?? If you liked it so far, hit the ⭐️ button to give me a 🤩 face.

laravel-tongue's People

Contributors

pmochine avatar pschocke avatar ruban-s avatar scrutinizer-auto-fixer avatar web-ruslan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel-tongue's Issues

Aliases with dialect()->current('locale') doesn't work as expected

Describe the bug
I'm trying to use the configuration aliases

config/localization

'aliases' => [
        'www' => 'ar',
],

I've also enabled ar in the supportedLocales list

the issue here is dialect()->current('ar') always return ar.domain.local
I expected to return www.domain.local

@if(tongue()->current() == 'en')
      <li>
          <a href="{{ dialect()->current('ar') }}">
              <i class="icon fas fa-globe text-primary"></i> en
          </a>
      </li>
@endif

aslo

@foreach (dialect()->translateAll(true) as $locale => $url)
      <a href="{{ $url }}">{{ $locale }}</a>
@endforeach

returns

<a href="http://fr.infoeg.local:8000/cairo/categories">fr</a>
<a href="http://ar.infoeg.local:8000/cairo/categories">ar</a>

while expected

<a href="http://fr.infoeg.local:8000/cairo/categories">fr</a>
<a href="http://www.infoeg.local:8000/cairo/categories">ar</a>

I'm not sure if that is a bug or I misused it

Great job 💯 Thanks a lot 👍

Getting erorr when using Route::view & dialect()->current('www')

Getting erorr when using

// routes/web.php
Route::view('/privacy', 'privacy')->name('privacy');

// some blade 
@if(tongue()->current() == 'en')
      <a href="{{ dialect()->current('www') }}">
          @lang('text.lang_switch')
      </a>
@endif

the error is TypeError

vendor\pmochine\laravel-tongue\src\Accent\Accent.php : 81
TypeError
str_replace(): Argument #2 ($replace) must be of type string when argument #1 ($search) is a string

public static function substituteAttributesInRoute($attributes, $route)

    {

        foreach ($attributes as $key => $value) {

            $route = str_replace('{'.$key.'}', $value, $route);   // error happens here 

            $route = str_replace('{'.$key.'?}', $value, $route);

        }

Thanks

Reverse alias operation

Hi man, excelent package you provide to us!

I have a config scenario...

   'aliases' => [
        'das' => 'pt-BR',
    ],

  'acceptLanguage' => true,

  'prevent_redirect' => env('PREVENT_REDIRECT', false),

When I try to get the app index page using a browser with pt-BR default language I got a redirection error.

Instead redirect to das.domain.test, the result is pt_br.domain.test.

Of course when I try to get directly das.domain.test I got te correct pt-BR locale.

Is it right?

Tks.

Jefferson

no running in local environment

Describe the bug
This is not actually a bug but a question because based on the readme there is no instruction on how to run or at least test this on the local environment. I already follow the step-by-step process as indicated on the readme and when I re-run the app and add a subdomain in which is my selected localization(which is FR, for example, fr.localhost:8000) but the results are error 500.
Is there any way to test it via the local environment?

Thank you.

Desktop (please complete the following information):

  • OS: Windows 10 Pro
  • Browser Google Chrome Canary and Firefox
  • Version Latest

Additional context
Local Environment Setup:

  • Laragon (latest version)
  • PHP 7.4.2
  • MYSql 8
  • Laravel 6.*

Supported locales must be properly defined.

I've been using this library in development, and everything was working OK, but when I upload on my production server and run composer install, this error is thrown and all the pages stoped working:

 Pmochine\LaravelTongue\Exceptions\SupportedLocalesNotDefined

  Supported locales must be properly defined.

  at vendor/pmochine/laravel-tongue/src/Misc/ConfigList.php:15
    11|     {
    12|         $locales = Config::supportedLocales();
    13|
    14|         if (empty($locales) || ! is_array($locales)) {
  > 15|             throw new SupportedLocalesNotDefined();
    16|         }
    17|
    18|         if (! $key) {
    19|             return collect($locales);

      +5 vendor frames
  6   app/Providers/RouteServiceProvider.php:33
      Pmochine\LaravelTongue\Tongue::detect()

I've already tried to copy vendor file again, clear Laravel cache and nothing worked.
Could you help me?

support for Laravel 11 please

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

dialect()->translate() doesn't work on controllers

I'm switching the languages on my site via controllers (a select element on a form that calls a POST route/controller when language is selected), but when I use dialect()->translate() in my controller, to translate the current route and redirect the user to the translated route, it always returns my current POST route that is reading my request to switch the language, not the translated route that it should return.

And if I use dialect()->redirectUrl() it returns the URL not parsed and doens't translate de route to the selected language, as its described on your documentation.

What should I do? The only solution would be switching languagues without using controllers? The dialect()->translate() function works perfectly outside controllers.

Thank you.

Best way to omit subdomain when locale == fallback_locale?

Hi, thanks for this package.

If I do this:

app.php > 'fallback_locale' => 'en'
$lang = 'en'
<a href="{{ dialect()->translate('routes.contact', null, $lang) }}">{{ __('contact.contact_us', [], $lang) }}</a>

the subdomain is included in the URL e.g.
https://en.example.test

I changed Dialect::translate to:

        // Add locale to the host
        //$parsed_url['host'] = $locale.'.'.Localization::domain();
		
	// Add locale to the host if locale != fallbackLocale
        if (Config::beautify() && $locale === Config::fallbackLocale()) {
            $parsed_url['host'] = Localization::domain();
        } else {
            $parsed_url['host'] = $locale.'.'.Localization::domain();
        }		

Is there are better to do what I want without changing the Dialect class?

always getting en as a default locale, even config/app is ar

always getting en as a default locale, even config/app is ar

config/app.php

'locale' => 'ar',
 dd(app()->currentLocale(), tongue()->current());

output

en
en

if I commented out RouteServiceProvier.php

    public function boot()
    {
        // tongue()->detect();
   }
 dd(app()->currentLocale());

output

ar

Other subdomains won't behave correctly

Introduction

The issue is when you have other subdomains such as nova.domain.test, the root path will still show the original website and not changing to the Nova Admin panel. The second case is when the subdomain, in my case luxury.domain.test, it loads the other layout but the routes won't map correctly. Let me be more clear.

Setup

I have the following subdomains:

  • nova.domain.test
  • luxury.domain.test
  • fr.domain.test
  • en.domain.test

The .env values are the following:

APP_DOMAIN=domain.test
SESSION_DOMAIN=.domain.test
// config/localization.php
[ 
 'subdomains' => [
        'nova',
        'luxury',
    ],
]

The routes within the luxury package are wrapped in this way:

Route::middleware('web')->domain('luxury.' . env('APP_DOMAIN') )->group(function(){
     // routes...
});

and for nova, I have set the following values in the config:

// config/nova.php
[
    'path' => '/',
]

and .env file

NOVA_DOMAIN_NAME=nova.domain.test

Describing Issue

Now, I have two scenarios.

If I wrap my default routes within the web.php like this

Route::domain(env('APP_DOMAIN'))->group(function(){
  // routes...
});

everything works fine but not the translated routes. When trying to access a translated subdomain it gives a 'route is null' or not defined.

However, in the second scenario if I remove the above code, the translated subdomains are working as intended, but the other two subdomains are behaving differently.

  • nova.domain.test when accessed at the root path it will still show the original website.
  • luxury.domain.test when accessed at the root path it will show the correct website, but the other routes will be mapped using this domain.
    Example:
    If I have the following route under the root domain:
Route::get('contact', [ContactController::class, 'index'])->name('contact.index');

When used under the subdomain luxury.domain.test as

 {{ route('contact.index') }}

It will map to luxury.domain.test/contact instead of domain.test/contact.
However, every route for nova still works fine once you reach the dashboard by manually typing nova.domain.test/dashboard or any other route.

foreach -> mcamara ??

@foreach(LaravelLocalization::getSupportedLocales() as $localeCode => $properties)
  @if($url = LaravelLocalization::getLocalizedURL($localeCode) and $localeCode != LaravelLocalization::getCurrentLocale())
      <a rel="alternate" hreflang="{{ $localeCode }}" href="{{$url}}" class="dropdown-item notify-item language" data-lang="{{ LaravelLocalization::getCurrentLocale() }}">

          <div class="card-body p-0 d-flex">
              <div class="pt-1 bd-highlight">
                  <img width="16" height="16" src="{{ asset('next/s3/flags/'. $localeCode .'.png') }}" alt="user-image" class="me-2 mb-2">
              </div>

              <h5 class="fw-semibold text-grey-900 fs-sm mt-0 me-4">
                  {{{ !empty($abbr) ? $localeCode : $properties['native'] }}}
              </h5>
          </div>

      </a>
  @endif
@endforeach

Default subdomain FR

First : thanks a lot for this package, good job !

I would like to set default language as fr (without subdomain) and a subdomain for en.

In /app/config.php :

'locale' => 'fr',
'fallback_locale' => 'en'

When I visit the domains :

However, when I use dialect()->current('fr') it returns fr.my_domain.dv and dialect()->current('en') returns my_domain.dv

How can I fix it ?
Thanks a lot !

Use custom subdomain instead of locale string?

This package looks very promising! I have one question though, is it possible to use custom subdomains? I would like to use

gewinnen.domain.com --> "de"
gagner.domain.com --> "fr",

so not actually having the locale string in the domain, but I would need to map this to the specific locale somehow?

Thanks,

Robert

tongue()->detect() with Laravel Octane

Hi,
I'm trying to use Laravel-Tongue with Laravel Octane.
All works as expected, except for the automatic language detection by client settings.

So, if I access the application with a language (IT in my case) that is different from the default (EN), the tongue()->detect(); do not detect the correct language.

I run the tongue()->detect() fun from a custom middleware, because the boot() function in Octane run only at server startup.

Laravel version: 10.15.0
Tongue version: 5.0.0

This is the middleware:

class Localize
{
    public function handle(Request $request, Closure $next): Response
    {
        tongue()->detect();
        Carbon::setLocale(tongue()->current());

        Log::debug("Localize: ".tongue()->current());

        return $next($request);
    }
}

And my localization.php

<?php

return [
    /*
    |--------------------------------------------------------------------------
    | Domain name
    |--------------------------------------------------------------------------
    |
    | Here you may change the name of the domain used in your application.
    | By default, the domain is read from the .env file.
    | Example: APP_DOMAIN=185ad73e.eu.ngrok.io (only because of this we know what your real domain is)
    |
    */
    'domain' => env('APP_DOMAIN'),

    /*
    |--------------------------------------------------------------------------
    | Beautify url
    |--------------------------------------------------------------------------
    |
    | Use to set fallback language to mydomain.com and not to en.mydomain.com
    | Other languages are getting e.g. fr.mydomain.com
    |
    */
    'beautify_url' => false,
    /*
    |--------------------------------------------------------------------------
    | subdomains that are whitelisted
    |--------------------------------------------------------------------------
    |
    | If you don't want to be redirected, when you have special subdomains
    | for example 'admin', 'archontas', 'nova' etc.
    |
    */
    'subdomains' => [
        'api'
    ],
    /*
    |--------------------------------------------------------------------------
    | custom locale subdomains via aliases
    |--------------------------------------------------------------------------
    |
    | Let's say you don't want to use locale as a subdomain.
    | You can add your custom subdomains here. Example:
    | gewinnen.domain.com --> "de"
    | gagner.domain.com --> "fr",
    |
    */
    'aliases' => [
        'zhs' => 'zh', //important: it has to match with an active locale from the supportedLocales list
        'zht' => 'zh-Hant',
        'ph'  => 'fil',
        'grc' => 'el'
    ],
    /*
    |--------------------------------------------------------------------------
    | https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language
    |--------------------------------------------------------------------------
    |
    |  Negotiate for the user locale using the Accept-Language header if it's not defined in the URL
    |  If false, system will take app.php fallback locale attribute
    |
    */
    'acceptLanguage' => true,
    /*
    |--------------------------------------------------------------------------
    | Cookie localization
    |--------------------------------------------------------------------------
    |
    | Use this option to enable or disable the use of cookies
    | in locale detection.
    |
    */
    'cookie_localization' => true,
    /*
    |--------------------------------------------------------------------------
    | Cookie Serialization
    |--------------------------------------------------------------------------
    |
    | If you have not changed anything in your middleware "EncryptCookies", you
    | don't need to change anything here as well.
    | For information visit:
    | https://laravel.com/docs/5.6/upgrade#upgrade-5.6.30
    */
    'cookie_serialize' => false,
    /*
    |--------------------------------------------------------------------------
    | Prevent redirect
    |--------------------------------------------------------------------------
    |
    | Sometimes in testing you don't want to use redirection.
    | If you set the value to true, the middleware TongueSpeaksLocale
    | will not redirect anymore.
    |
    */
    'prevent_redirect' => env('PREVENT_REDIRECT', false),

    // Uncomment the languages that your site supports - or add new ones.
    // These are sorted by the native name, which is the order you might show them in a language selector.
    // Regional languages are sorted by their base language, so "British English" sorts as "English, British"
    'supportedLocales' => [
        'de'          => ['name' => 'German',                 'script' => 'Latn', 'native' => 'Deutsch', 'regional' => 'de_DE'],
        'en'          => ['name' => 'English',                'script' => 'Latn', 'native' => 'English', 'regional' => 'en_GB'],
        'es'          => ['name' => 'Spanish',                'script' => 'Latn', 'native' => 'español', 'regional' => 'es_ES'],
        'fil'         => ['name' => 'Filipino',               'script' => 'Latn', 'native' => 'Filipino', 'regional' => 'fil_PH'],
        'fr'          => ['name' => 'French',                 'script' => 'Latn', 'native' => 'français', 'regional' => 'fr_FR'],
        'it'          => ['name' => 'Italian',                'script' => 'Latn', 'native' => 'italiano', 'regional' => 'it_IT'],
        'hu'          => ['name' => 'Hungarian',              'script' => 'Latn', 'native' => 'magyar', 'regional' => 'hu_HU'],
        'pt'          => ['name' => 'Portuguese',             'script' => 'Latn', 'native' => 'português', 'regional' => 'pt_PT'],
        'el'          => ['name' => 'Greek',                  'script' => 'Grek', 'native' => 'Ελληνικά', 'regional' => 'el_GR'],
        'ru'          => ['name' => 'Russian',                'script' => 'Cyrl', 'native' => 'русский', 'regional' => 'ru_RU'],
        'he'          => ['name' => 'Hebrew',                 'script' => 'Hebr', 'native' => 'עברית', 'regional' => 'he_IL'],
        'ar'          => ['name' => 'Arabic',                 'script' => 'Arab', 'native' => 'العربية', 'regional' => 'ar_AE'],
        'sa'          => ['name' => 'Sanskrit',               'script' => 'Deva', 'native' => 'संस्कृतम्', 'regional' => 'sa_IN'],
        'ja'          => ['name' => 'Japanese',               'script' => 'Jpan', 'native' => '日本語', 'regional' => 'ja_JP'],
        'zh'          => ['name' => 'Chinese (Simplified)',   'script' => 'Hans', 'native' => '简体中文', 'regional' => 'zh_CN'],
        'zh-Hant'     => ['name' => 'Chinese (Traditional)',  'script' => 'Hant', 'native' => '繁體中文', 'regional' => 'zh_CN'],
        'ko'          => ['name' => 'Korean',                 'script' => 'Hang', 'native' => '한국어', 'regional' => 'ko_KR'],
    ],
];

If I change manually the language with https://it.foo.bar, all works.

Any idea?
Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.