Skip to content

Library development best practices: detect missing /sap.ui5/library/i18n: false #1087

Description

@boghyon

Is your feature request related to a problem? Please describe.

Similar to #1084, there is an equivalent i18n case.

A library's manifest.json can declare its i18n configuration via the /sap.ui5/library/i18n descriptor entry. When a library ships no translatable texts, this should be set to false. Otherwise, the framework would fall back to requesting multiple resource bundles at runtime unnecessarily that end up with 404.

<lib namespace>/messagebundle_<locale>.properties --> 404
<lib namespace>/messagebundle.properties          --> 404

How the framework interprets /sap.ui5/library/i18n

Value Meaning
false Telling that the library has no own resource bundle --> no unnecessary request
true or omitted messagebundle*.properties requests
URL string Shorthand for { bundleUrl: "..." } --> requests
object Requests in accordance with { bundleUrl, bundleName, supportedLocales, fallbackLocale, ... }

Only false prevents bundle loading. Every other value causes the framework to request a bundle. So a library that provides no *.properties bundle but doesn't set i18n: false triggers an avoidable 404.

Describe the solution you'd like

For a project of type "library", warn when all of the following apply:

  1. The (generated) manifest.json would not set /sap.ui5/library/i18n to false, and
  2. the library ships no matching *.properties file
    --> A resolved *.properties file that is effectively empty (only comments or blank lines) should count as "no i18n" too in my view.

Autofix

Set "i18n": false under /sap.ui5/library in manifest.json:

 {
   "sap.ui5": {
     "library": {
+      "i18n": false

Metadata

Metadata

Assignees

Labels

autofixAn issue related to the autofix capabilitiesdetectionAn issue related to detection capabilities

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions