Paradaux

PAR-252

0

Merge missing message keys from the jar default into the operator's messages.properties on upgrade

BacklogUnassignedHiberniaFrameworkFeature

Part of PAR-251.

Today

Message.ensureDefaultFile() (i18n/Message.java:265-276) writes the bundled messages.properties only when the operator has no base file — comment in code: saveResource(…, true) would clobber operator-edited messages, so it's intentionally write-once. reload() (:279-301) then loads messages*.properties from the data folder only; nothing consults the jar resource for keys missing on disk. So a key a new release adds is absent from any operator who already had a messages.properties, and findRaw() returns null → the literal key is rendered (only framework built-ins that use componentOr(key, fallbackPattern, …) survive a missing key).

Want

On upgrade (trigger per PAR-251), reconcile the base bundle:

  1. Load jar default via plugin.getResource("messages.properties") into a Properties.
  2. Load the on-disk messages.properties into a Properties.
  3. For every key in the jar default not present on disk, add it with the jar's value.
  4. Write the on-disk file back, leaving every existing operator value and any operator-added key untouched.
  5. Then let reload() run as normal.

Scope / notes

  • Base bundle only. Locale bundles (messages_<lang>[_<COUNTRY>].properties) are translator/operator-managed and the jar usually ships only the base; don't synthesize translations. Per-key locale fallback already covers untranslated keys.
  • .properties is flat and largely comment-free; carrying # comment lines across is a nice-to-have, not required (the comment-preservation ask in PAR-251 is for config.yml). java.util.Properties doesn't round-trip comments/order — if comment/order preservation is wanted later, a small line-based merge would be needed.
  • Keep it idempotent: a second run with no new keys writes nothing (or a byte-identical file).

Done when

  • Deploying a version that adds a message key leaves an operator's pre-existing messages.properties containing that key at its shipped default, with their edited keys unchanged and no duplicates.
  • Locale/translation files are untouched.

Ref: hibernia-framework @ efc3f9b.

Comments

No comments yet.

Activity

  • tesks created the issue