Class LaravelUi5\Core\Http\Middleware\ResolveRequestLanguage

Sets the request's language from what the UI5 client sends.

Order: the sap-language query parameter, else the first entry of Accept-Language, else nothing (the app's configured locale stays). The winner is written to the request ($request->setLocale()) and the app (app()->setLocale()), so Ui5ContextInterface::locale() and the translator see the same language.

OpenUI5 sends Accept-Language on every OData request, code-list loads included, taken from sap-ui-language. It sends sap-language only when an app writes it into its service URL — so Accept-Language is the channel that carries the language, and sap-language is the override.

The value is a language, not a locale: the primary subtag, lower case (de-AT → de, DE → de). Laravel's translator does not fall back from de_AT to de, and code-list texts are kept per language. A value that is not a language tag (SAP's internal codes such as 1Q, *) is ignored and the next channel decides.

The locale slot is unaffected: it is read through the parameter pipeline.

Belongs in ui5.odata_middleware, ahead of any middleware that builds the context (e.g. the SDK's BindSdkContextForOData).

Methods