Skip to content

feat: keep customer locale edits and panel images out of the tracked files - #46

Merged
Musiker15 merged 3 commits into
mainfrom
feat/custom-locale-layer
Nov 5, 2026
Merged

Musiker15 merged 3 commits into
mainfrom
feat/custom-locale-layer

Conversation

@Musiker15

Copy link
Copy Markdown
Member

Description

An update via git pull failed as soon as a customer had edited a locale in the dashboard or replaced the panel logo, because both live in tracked files. That blocked the dashboard's update button, our bulk update of hosted bots and every self-hoster.

Customer locale layer. Edits from the dashboard now go to locales/custom/<lang>.json (gitignored) and hold only the values that differ from the shipped file. The bot and the transcript load the shipped file and lay the custom file on top (src/utils/locales.js). New keys and fixes to untouched texts arrive with every update, customer texts stay. A broken custom file only logs a warning. The editor still shows the full file, PUT stores the difference, and a new DELETE /locales/:name (with a button in the editor) resets a file to the default.

Panel images. Customer images in assets/ are gitignored. panel.js looks in assets/<file> first and falls back to assets/default/<file>. The default logo is copied to assets/default/logo.png; assets/logo.png stays tracked in this release, because the first update to this version still runs through the old plain git pull, and moving it now would break exactly that update for anyone with their own logo. It can be removed in a later release.

Update routine. src/utils/updater.js runs behind the dashboard's update button and behind the new npm run update. It resets package-lock.json, moves legacy edits of tracked locales into the custom layer once (backup as <file>.pre-custom-layer), puts a replaced logo aside and back, then git pull --ff-only and npm install --omit=dev. Files put aside come back even if the pull fails.

Related Issue

None. Came up while updating the hosted bots to 2.22.0: all three customers had edited a locale that the release changed.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 🌍 Translation / locale update
  • 📖 Documentation only
  • 🔧 Refactor / chore (no functional change)

How Was This Tested?

npm test: 423 passed. New: tests/locale-layer.test.js, tests/panel-assets.test.js, tests/updater.test.js (the updater tests use real temporary git repos with an upstream and a release commit). Counter-checks: diff returning the whole object, migration not writing the custom file, reversed precedence and logo not restored each turned the tests red, then restored. The real routes were smoke-tested through Express (GET, PUT, invalid PUT, path traversal, DELETE, audits).

Not yet tried on a running hosted bot.

Checklist

  • My code follows the project's conventions
  • No new production dependencies were added
  • User-facing strings go through client.t(...) and the dashboard UI keys are in all seven web/src/locales files
  • Any DB schema change uses an inline migration (no schema change)
  • The bot still works without MSK_API_KEY
  • The bot starts cleanly (npm start) and I verified my change on a test server
  • I updated the relevant docs (docs/ in both languages)
  • I added a CHANGELOG.md entry under [Unreleased]
  • My commit messages are in English and follow Conventional Commits

After deploying, the dashboard service itself needs one restart (the update button only restarts the bot), otherwise the old routes keep writing into the tracked files.

Comment thread src/utils/locales.js Fixed
Comment thread src/utils/locales.js Fixed
Comment thread src/utils/locales.js Fixed
Comment thread src/utils/updater.js Fixed
Comment thread src/utils/updater.js Fixed
Comment thread src/utils/locales.js Fixed
@Musiker15
Musiker15 merged commit e6b0b29 into main Nov 5, 2026
6 checks passed
@Musiker15
Musiker15 deleted the feat/custom-locale-layer branch November 5, 2026 17:09
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