supportedLocales 和 fallbackLocale 的组合不会阻止 UI5 请求不存在的 i18n-localizations

A combination of supportedLocales and fallbackLocale doesn't prevent UI5 from requesting unexisting i18n-localizations

为了在 UI5 中配置 i18n 功能,我在 manifest.json 的 sap.ui5 中使用了以下代码片段:

"models": {
    "i18n": {
        "preload": true,
        "settings": {
            "bundleName": "webapp.i18n.i18n",
            "bundleUrl": "i18n/i18n.properties",
            "fallbackLocale": "en",
            "supportedLocales": [
                "en"
            ]
        },
        "type": "sap.ui.model.resource.ResourceModel"
    }
},

感谢 supportedLocalesfallbackLocale 我不认为 UI5 会请求不存在的本地化,但实际上我仍然观察到 i18n_en_US.properties:[=23 不需要的 404 请求=]

GET http://localhost:3000/i18n/i18n_en_US.properties 404 (Not Found)

我假设 supportedLocalesfallbackLocale 背后的整个想法是减少本地化请求的数量,这些请求不存在且未在 supportedLocales 中指定。

我的问题:

我找出了不需要的 404 请求的原因。 最初,我为 sap.ui5/models/i18n 部分定义了 fallbackLocalesupportedLocales,但在 sap.app 中也有一个 i18n 部分,这也需要 fallbackLocalesupportedLocales 配置。

最终解决方案是将以下代码片段添加到 manifest.json 的 sap.app 部分:

"i18n": {
    "bundleName": "webapp.i18n.i18n",
    "fallbackLocale": "en",
    "supportedLocales": [
        "en"
    ]
},