Skip to content

Keep the chosen metadata language when other settings are saved - #5396

Merged
marcelveldt merged 2 commits into
devfrom
fix-metadata-language-default
Aug 6, 2026
Merged

Keep the chosen metadata language when other settings are saved#5396
marcelveldt merged 2 commits into
devfrom
fix-metadata-language-default

Conversation

@marcelveldt

@marcelveldt marcelveldt commented Aug 6, 2026

Copy link
Copy Markdown
Member

What does this implement/fix?

If your metadata language was set to English (US), it could get silently replaced by the language of whatever browser or app connected next.

The language setting declared English (US) as its default value, and Music Assistant only stores settings that differ from their default. So choosing English (US) and then saving anything else on the Metadata settings page dropped the language from storage — after which it looked like no language had ever been chosen, and the next client to connect (or a Spotify/Qobuz login) would set its own.

The language setting no longer declares a default, so an explicit choice is always stored. English (US) is still what's used when nothing has been chosen yet.

Types of changes

  • Bugfix (non-breaking change which fixes an issue) — bugfix
  • New feature (non-breaking change which adds functionality) — new-feature
  • Enhancement to an existing feature — enhancement
  • New music/player/metadata/plugin provider — new-provider
  • Breaking change (fix or feature that would cause existing functionality to not work as expected) — breaking-change
  • Refactor (no behaviour change) — refactor
  • Documentation only — documentation
  • Maintenance / chore — maintenance
  • CI / workflow change — ci
  • Dependencies bump — dependencies

Changes:

  • Removed the default value from the metadata language config entry so a chosen language is always persisted.
  • Added tests covering a real save/reload round-trip for both a default and a non-default language.
  • Side effect: the Language dropdown no longer tags English (US) as [Default], and shows no selection until a language has been picked or detected. The language actually used is still English (US) in that case.

Checklist

  • The code change is tested and works locally.
  • pre-commit run --all-files passes.
  • pytest passes, and tests have been added/updated under tests/ where applicable.
  • For changes to shared models, the companion PR in music-assistant/models is linked.
  • For changes affecting the UI, the companion PR in music-assistant/frontend is linked.
  • I have read and complied with the project's AI Policy for any AI-assisted contributions.
  • I have raised a PR against the documentation repository targeting the main or beta branch as appropriate.

Copilot AI lite review requested due to automatic review settings August 6, 2026 09:10
@github-actions github-actions Bot added the bugfix label Aug 6, 2026

Copilot AI 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.

Pull request overview

Fixes a config persistence edge case where selecting the metadata language equal to the previous default (DEFAULT_LANGUAGE, e.g. en_US) could be dropped from stored core config on unrelated saves, allowing later clients/providers to overwrite the language as if it had never been chosen.

Changes:

  • Removed default_value from the metadata CONF_LANGUAGE ConfigEntry so an explicit choice is always persisted.
  • Kept DEFAULT_LANGUAGE behavior as the runtime fallback via the locale property when no language is stored.
  • Added regression tests covering save behavior for both the previous default language and a non-default language.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/controllers/metadata/test_preferred_language.py Adds regression tests validating that an explicitly chosen language survives unrelated metadata config saves and cannot be overridden by default seeding afterward.
music_assistant/controllers/metadata/controller.py Removes the config-entry default for CONF_LANGUAGE while keeping DEFAULT_LANGUAGE as the runtime fallback for reads.

Copilot AI review requested due to automatic review settings August 6, 2026 09:23
The language config entry declared en_US as its default. Since only values
that differ from their default are stored, choosing English (US) dropped the
key on the next save of the metadata settings, making it look like no language
had ever been chosen. A client connecting afterwards could then silently
replace it with its own browser language.

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@marcelveldt
marcelveldt marked this pull request as ready for review August 6, 2026 10:44
@marcelveldt
marcelveldt merged commit 377eefa into dev Aug 6, 2026
19 checks passed
@marcelveldt
marcelveldt deleted the fix-metadata-language-default branch August 6, 2026 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants