-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Normal
-
Affects Version/s: 3.0.0rc2
-
Component/s: Options, User Interface
-
None
When opening Options -> Options and selecting the Metadata section, the page can be accessed once, and then the "Metadata" tree entry greys out and can no longer be selected for the rest of the dialog's lifetime.
This was reported by a user upgrading from Picard 2 to Picard 3 RC2 (the RC2 installer replaced the Picard 2 installation, so the existing configuration was carried over). The user's interface language was English.
https://community.metabrainz.org/t/picard-3-release-candidate-2/815620/3?u=zas
Root cause
==========
The Metadata options page loads the configured translation locales (config.setting['translation_locales'], previously named 'artist_locales' in Picard 2 and renamed by an upgrade hook) and looks each one up directly in the ALIAS_LOCALES dictionary:
gettext_constants(ALIAS_LOCALES[locale])
ALIAS_LOCALES is derived from CLDR data, which changes between releases. If the carried-over config references a locale code that no longer exists in the CLDR data shipped with Picard 3 (for example 'sh' Serbo-Croatian, 'zh_CN', or 'sr_CS'), the lookup raises KeyError.
The exception propagates out of the page's load() method. The options dialog catches it and calls disable_page('metadata'), which sets the tree item disabled. However, the dialog still displays the page content that one time, which is why the page appears "once" and is then permanently greyed out.
Steps to reproduce
==================
1. Use a configuration where translation_locales contains a locale code not present in Picard 3's ALIAS_LOCALES (e.g. 'sh'). This happens naturally when upgrading from an older Picard whose CLDR data included that code.
2. Open Options -> Options.
3. Select a page other than Metadata (so Metadata is lazily loaded on click).
4. Click "Metadata".
Expected: the Metadata page opens and stays selectable.
Actual: the page opens once, then the "Metadata" tree entry is greyed out and cannot be selected again.
Note: it may also happens if the config for translation_locales is totally or partially corrupted.