mcamara/laravel-localization — pull request #126 by brwnll (2014-08-16 20:47:42+00:00)
Title: Allow unsupported languages in URL

I needed the same functionality as issue #114.

Current functionality:
--------------------------
1. Website supports a subset of languages: e.g. ES & EN
2. User attempts to visit URL for unsupported language: "www.website.com/cch/about"
3. A HTTP Not Found error is thrown.

My desired functionality:
------------------------------
3 The page is loaded, using the unsupported language URL, but the default langue is used.

What I did
-------------
1. Changed the config format.
A. Took all the languages from the `allowedLocales` array and added them (uncommented) to a config key called `allLocales`.
B. Deleted all commented languages from the `allowedLocales` config array.
C. Added a config variable named `allowUnsupported`

2. Added the appropriate getters to `LaravelLocalization.php`

3. Added the check to the `setLocale()` function which is used as the route filter to check for the config and allow any language to be in the URL if so.

4. Updated the create URL functions `getLocalizedURL` and `localizeURL` to correctly parse out any language path if using `allowUnsupported`.