Reputation: 14616
To configure the i18n
functionality in UI5, I'm using the following snippet in the sap.ui5
of manifest.json:
"models": {
"i18n": {
"preload": true,
"settings": {
"bundleName": "webapp.i18n.i18n",
"bundleUrl": "i18n/i18n.properties",
"fallbackLocale": "en",
"supportedLocales": [
"en"
]
},
"type": "sap.ui.model.resource.ResourceModel"
}
},
Thanks to supportedLocales
and fallbackLocale
I don't expect that UI5 will request unexisting localizations, but in fact I still observe unwanted 404-requests for i18n_en_US.properties
:
GET http://localhost:3000/i18n/i18n_en_US.properties 404 (Not Found)
I assumed that the whole idea behind of supportedLocales
and fallbackLocale
is to reduce amount of requests of localizations, which don't exist and are not specified in supportedLocales
.
My questions:
Why UI5 anyway tries to request i18n_en_US.properties
although en_US
doesn't appear in a list of supportedLocales
?
Is it possible to get rid of extra requests for unsupported locales?
Upvotes: 2
Views: 440
Reputation: 14616
I figured out the reason for the unwanted 404-requests.
Initially, I've defined fallbackLocale
and supportedLocales
for the sap.ui5/models/i18n
section, but there is also an i18n
section in sap.app
, which also requires fallbackLocale
and supportedLocales
configuration.
The final solution is to add the following code-snippet into sap.app
section of manifest.json:
"i18n": {
"bundleName": "webapp.i18n.i18n",
"fallbackLocale": "en",
"supportedLocales": [
"en"
]
},
Upvotes: 6