Skip to content

Batch actions: fetch all pages when requesting locales from API - #4420

Merged
flodolo merged 2 commits into
mozilla:mainfrom
MundiaNderi:increase-locale-limit
Aug 19, 2026
Merged

Batch actions: fetch all pages when requesting locales from API#4420
flodolo merged 2 commits into
mozilla:mainfrom
MundiaNderi:increase-locale-limit

Conversation

@MundiaNderi

Copy link
Copy Markdown
Collaborator

Fix #4419

Set page_size to the maximum(1000) to cover current and future locale counts.

Set page_size to the maximum to cover current and future locale counts
@MundiaNderi
MundiaNderi requested a review from flodolo August 17, 2026 13:44

@flodolo flodolo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this fixes the immediate problem, we should make the code able to deal with paginated (it shouldn't require too much additional code).

I wasn't involved in the original implementation, but maybe we should also fetch the list of locales for the project we're in, and fall back to all locales? The copy only makes sense if the locale has translations, and that won't be possible if the locale is not available.

e.g. for Firefox use https://pontoon.mozilla.org/api/v2/projects/firefox/, for All projects use the current https://pontoon.mozilla.org/api/v2/locales/

Happy to keep the project-specific locales for a follow-up.

@MundiaNderi

Copy link
Copy Markdown
Collaborator Author

While this fixes the immediate problem, we should make the code able to deal with paginated (it shouldn't require too much additional code).

I wasn't involved in the original implementation, but maybe we should also fetch the list of locales for the project we're in, and fall back to all locales? The copy only makes sense if the locale has translations, and that won't be possible if the locale is not available.

e.g. for Firefox use https://pontoon.mozilla.org/api/v2/projects/firefox/, for All projects use the current https://pontoon.mozilla.org/api/v2/locales/

Happy to keep the project-specific locales for a follow-up.

I'll add pagination and update the patch. Happy to file a separate issue for the project-specific locales after this PR is merged.

@MundiaNderi MundiaNderi self-assigned this Aug 18, 2026
@flodolo

flodolo commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

@MundiaNderi
Sorry if it wasn't clear, I meant that we should fetch multiple pages from the API, not paginate the dropdown.

Something like

  let url: string | null = `/api/v2/locales/?${search}`;

  while (url) {
    const result = await GET(url);
    if (Array.isArray(result?.results)) {
      locales.push(...result.results);
    }
    url = result?.next ?? null;
  }

@MundiaNderi
MundiaNderi force-pushed the increase-locale-limit branch from e97fc24 to fb64d99 Compare August 19, 2026 09:57
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.55%. Comparing base (daa4ec2) to head (fb64d99).
⚠️ Report is 3 commits behind head on main.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@flodolo flodolo changed the title Increase locale list page_size to prevent truncation Batch actions: fetch all pages when requesting locales from API Aug 19, 2026
@flodolo
flodolo merged commit 8ca631c into mozilla:main Aug 19, 2026
10 checks passed
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.

Several locales missing from the list of languages to copy strings from

3 participants