Download the PHP package mcaskill/slim-polyglot without Composer
On this page you can find all versions of the php package mcaskill/slim-polyglot. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mcaskill/slim-polyglot
More information about mcaskill/slim-polyglot
Files in mcaskill/slim-polyglot
Package slim-polyglot
Short Description Slim 3 language resolution middleware
License MIT
Homepage https://github.com/mcaskill/Slim-Polyglot
Informations about the package slim-polyglot
Slim 3 Polyglot
Resolves the response's current language based on the requested URI, the client's preferred language, and the available languages.
Alters the ResponseInterface
to assign the Content-Language
header.
Uses willdurand/Negotiation to detect and negotiate the client language.
Install
Via Composer:
Requires Slim 3.
Usage
The Polyglot middleware can also accept callbacks that are executed after a language is chosen.
Testing
TBD
Notes
The language code may be formatted as ISO 639-1 alpha-2 (en), ISO 639-3 alpha-3 (msa), or ISO 639-1 alpha-2 combined with an ISO 3166-1 alpha-2 localization (zh-tw).
When giving a list of languages to the Polyglot middleware, the first language is used as the fallback language. When switching to a language that is not in the list of supported languages, the first language is used instead.
Definitions:
- "language-fallback" — Default language; determined as the first among your supported languages.
- "language-preferred" — Preferred language(s); determined as the client's localization preferences.
- "language-current" — Current language; determined as the localization to use based on a cross-reference of the application's supported languages and the client's priority of preferred languages.
License
The MIT License (MIT). Please see the License File for more information.