Skip to content

Make active locales optionally repo-dependent#4257

Open
eemeli wants to merge 4 commits into
mozilla:mainfrom
eemeli:repo-locales
Open

Make active locales optionally repo-dependent#4257
eemeli wants to merge 4 commits into
mozilla:mainfrom
eemeli:repo-locales

Conversation

@eemeli

@eemeli eemeli commented Jun 24, 2026

Copy link
Copy Markdown
Member

Fixes #3677

Adds a new control to the top of the /admin/projects/:slug/ page, by default unselected:
Screenshot 2026-06-24 at 19 49 00

If the project uses a config file, the text is slightly different:
Screenshot 2026-06-24 at 19 49 40

And if it's selected and no config file is used, a second checkbox is presented:
Screenshot 2026-06-24 at 19 52 44

Note also how the list of locales is not shown when they're controlled by the repo contents or a config file. The new checkboxes are not shown if the project data source is the database, and not a repository.

Also, when the first checkbox is changed from "off" to "on" or when the config file value changes, the save button is now slightly different:
Screenshot 2026-06-24 at 19 54 09

@mathjazz Is there a way to detect when we're in prod or not? It would probably be good for the sync to use commit=False in dev environments.

The sync behaviour is correspondingly updated so that the ProjectLocale entities are updated if necessary, and the file-existence checks and file-removal changes are only applied if a config file is not used, and both checkboxes are ticked.

@eemeli eemeli requested a review from mathjazz June 24, 2026 17:04
@mathjazz

Copy link
Copy Markdown
Collaborator

Adds a new control to the top of the /admin/projects/:slug/ page, by default unselected:

If the project uses a config file, the text is slightly different:

Should we instead follow the UX of the "Data source" section and use a dropdown (Manual configuration, Read from repository, Read from configuration file)?

Also, checkbox help text looks a little out of place. Is help text even needed for relatively long labels? Or should we just use tooltips or links to the docs? If we stick to the checkboxes, we could take a step closer to the UI unity and use the checkbox style and help text from the settings page.

In any case, this change also requires docs updates.

And if it's selected and no config file is used, a second checkbox is presented:

I had to read the label and the description three times each to understand what this is supposed to do. 😉

Note also how the list of locales is not shown when they're controlled by the repo contents or a config file. The new checkboxes are not shown if the project data source is the database, and not a repository.

Also, when the first checkbox is changed from "off" to "on" or when the config file value changes, the save button is now slightly different:

Why is that? We also require an explicit sync in other cases, e.g. after you first create a project.

Regardless, the button should not break into two lines.

@mathjazz Is there a way to detect when we're in prod or not? It would probably be good for the sync to use commit=False in dev environments.

I don't think so. We should add an environment variable. IS_PRODUCTION_INSTANCE would be useful, ALWAYS_SYNC_WITHOUT_COMMIT might be better.

@eemeli

eemeli commented Jun 25, 2026

Copy link
Copy Markdown
Member Author

Adds a new control to the top of the /admin/projects/:slug/ page, by default unselected:
If the project uses a config file, the text is slightly different:

Should we instead follow the UX of the "Data source" section and use a dropdown (Manual configuration, Read from repository, Read from configuration file)?

Probably not, because the toggle we're actually setting is the same, and it's choosing between manual and repo config. It's just that without a config file, we look for the presence of locale directories, while with a config file we look for their definition in its top-level locales array.

So the choice at this level is binary.

Also, checkbox help text looks a little out of place. Is help text even needed for relatively long labels? Or should we just use tooltips or links to the docs? If we stick to the checkboxes, we could take a step closer to the UI unity and use the checkbox style and help text from the settings page.

Sure; I just followed the full-width style that the page already uses.

I propose that refreshing the project admin page layout and styles ought to be a separate action.

In any case, this change also requires docs updates.

Yes; I held off on that because I figured we'd have this conversation, and the UI might change as a result. 😇

And if it's selected and no config file is used, a second checkbox is presented:

I had to read the label and the description three times each to understand what this is supposed to do. 😉

I welcome suggestions for alternate verbiage.

Note also how the list of locales is not shown when they're controlled by the repo contents or a config file. The new checkboxes are not shown if the project data source is the database, and not a repository.

Also, when the first checkbox is changed from "off" to "on" or when the config file value changes, the save button is now slightly different:

Why is that? We also require an explicit sync in other cases, e.g. after you first create a project.

So you're suggesting we don't force a sync even when we know that the user's choices effectively require one to be effective?

Regardless, the button should not break into two lines.

Fixed now by making it wider, so that it also matches the Pretranslate directly above it.

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.

Adding new locales to Gettext projects directly from Pontoon is no longer possible

2 participants