Skip to content

fix: fall back to Locale.ROOT when no i18n_en.properties exists for English locale#51

Merged
busehalis-sap merged 2 commits into
mainfrom
fix/i18n-english-root-fallback
Jul 24, 2026
Merged

fix: fall back to Locale.ROOT when no i18n_en.properties exists for English locale#51
busehalis-sap merged 2 commits into
mainfrom
fix/i18n-english-root-fallback

Conversation

@busehalis-sap

Copy link
Copy Markdown
Contributor

Summary

The plugin calls EdmxI18nProvider.getTexts(Locale.ENGLISH) to resolve English i18n texts. This reads the "en" key from the compiled i18n.json, which is only populated when i18n_en.properties exists. Having only i18n.properties (the CAP convention default fallback) was not sufficient.

Fix: When getTexts(Locale.ENGLISH) returns no app-specific keys, fall back to getTexts(Locale.ROOT) which reads from the default i18n.properties file. putIfAbsent ensures that explicit i18n_en.properties entries always take precedence when both files exist.

Changes

  • I18nHelper: when resolving English i18n texts, merge in Locale.ROOT entries as fallback via putIfAbsent

@Schmarvinius
Schmarvinius self-requested a review July 24, 2026 12:19

@Schmarvinius Schmarvinius left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm but i think you should add a short sentence about it in the changelog

@Schmarvinius Schmarvinius left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really a fix but more of a change or addition, but it's ok

@busehalis-sap

Copy link
Copy Markdown
Contributor Author

Actually, technically it is a fix. Without i18n_en.properties, the application was throwing an exception at startup, something like:

Missing or unresolved @notification.template.title for event 'BookOrdered', locale 'en'. Ensure the annotation is present and the i18n key exists in your properties file.

This shouldn't happen for English since i18n.properties (no suffix) is the CAP convention for the default/English fallback. The fix makes the plugin treat it as such.

@busehalis-sap
busehalis-sap merged commit 4e9301c into main Jul 24, 2026
7 checks passed
@busehalis-sap
busehalis-sap deleted the fix/i18n-english-root-fallback branch July 24, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants