Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color selector and Add Tile Wizard are not translatable #4089

Closed
amtriathlon opened this issue Nov 30, 2021 · 5 comments
Closed

Color selector and Add Tile Wizard are not translatable #4089

amtriathlon opened this issue Nov 30, 2021 · 5 comments
Assignees
Milestone

Comments

@amtriathlon
Copy link
Member

This was reported at the forum, translations are present, but they are not being used:

image

image

I confirmed this using Spanish translation, I need to investigate the cause.

@amtriathlon amtriathlon added this to the 3.6 milestone Nov 30, 2021
@amtriathlon amtriathlon self-assigned this Nov 30, 2021
@amtriathlon
Copy link
Member Author

The non translatable colors problem is due to setupColors being called before translation is enabled in main.cpp:

// set default colors

// install QT Translator to enable QT Dialogs translation

@amtriathlon
Copy link
Member Author

The non translatable tile name and description is likely due to the use of a static function which is also called before QT translator is enabled:

static bool _registerItems()

@amtriathlon
Copy link
Member Author

The way we solved the same problem in similar cases s.t. metrics registry is to call an initialize method after the translator is enabled:

// Initialize metrics once the translator is installed

@amtriathlon
Copy link
Member Author

For the Overview tiles I propose to make _registerItems a static member of OverviewItemConfig and call it from main, after the translator is enabled, it is a simple change, and it works.

WRT to colors, I am not sure about to move the call to setupColors due to the interdependence with the call to appsettings->migrateQSettingsSystem() documented in the code, even when this may not be needed anymore I would prefer not to take the risk, the easiest fix would be to call GCColor::setupColors() again once the translator is enabled to load the translated names, since this function only initializes static arrays it would be fast and safe.

@liversedge
Copy link
Member

I would not worry too much about elegance since this is a fairly static piece of the codebase. Simple is usually best :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants