Skip to content

Fix translation in AI panel preferences (fixes #21219)#21252

Open
Mr-Charvaka wants to merge 1 commit into
darktable-org:masterfrom
Mr-Charvaka:fix/issue-21219
Open

Fix translation in AI panel preferences (fixes #21219)#21252
Mr-Charvaka wants to merge 1 commit into
darktable-org:masterfrom
Mr-Charvaka:fix/issue-21219

Conversation

@Mr-Charvaka

@Mr-Charvaka Mr-Charvaka commented Jun 6, 2026

Copy link
Copy Markdown

Resolves #21219.

Purpose & Goal

This PR fixes untranslated task names (e.g., "denoise", "upscale", "mask") in the preferences AI tab.

Implementation Details

  1. Reverts any translated values in the underlying model list store (COL_TASK), keeping task keys completely raw.
  2. Implements a custom cell data layout function _task_cell_data_func in src/gui/preferences_ai.c.
  3. Sets the callback on task_col using gtk_tree_view_column_set_cell_data_func to dynamically translate task names only at display time using _(task).
  4. Defines a static dummy array with N_() task markers to enable xgettext to extract these strings into translation templates.

Testing & Verification Approach

  • Displayed the AI model list under different UI language settings. Verified that the task names display in the correct translated string.
  • Verified xgettext successfully extracts AI task strings.

Regression Safety

Keeping tree model values in COL_TASK raw avoids a configuration storage regression (e.g. where toggling active models saved localized configuration keys like plugins/preferences/ai/active_model/odszumianie instead of denoise under non-English locales).

Development Note

This pull request was prepared with AI-assisted pair-programming (using the Gemini-powered Antigravity agent), and has been manually reviewed and refined for correctness.

@andriiryzhkov

Copy link
Copy Markdown
Collaborator

How actual string for translations will be populated? There's not task names in this repository.

@Mr-Charvaka

Mr-Charvaka commented Jun 6, 2026

Copy link
Copy Markdown
Author

@andriiryzhkov Thank you for pointing this out! You are completely right — since the task names are dynamically loaded from ai_models.json, xgettext would not be able to extract them without a static reference in the codebase. I have updated this PR to declare the possible task names (mask, denoise, rawdenoise, upscale) in a static, unused array marked with N_() at the top of src/gui/preferences_ai.c. This forces xgettext to extract them into po/darktable.pot during the next translation update, making them available to translators while keeping the runtime translation lookup working correctly.

@andriiryzhkov

andriiryzhkov commented Jun 6, 2026

Copy link
Copy Markdown
Collaborator

Approach with unused array will technically work. However, it will cover only tasks currently defined. If someone adds custom task for use in Lua script, for example, it will not be translated. Also it is an additional and not very obvious maintenance item.

Probably fine for now as a workaround.

Another topic is translation itself. Tasks serve more like identifiers rather than correct translatable strings. I still think it is not a good idea to translate them.

@andriiryzhkov andriiryzhkov added scope: translation / strings make darktable international scope: AI features AI features related issues and PR labels Jun 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: AI features AI features related issues and PR scope: translation / strings make darktable international

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing translation in AI panel

2 participants