Desktop: Fixes #13346: Fix startup error when a non-English locale is selected #13347
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request fixes a "Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source" startup error by pre-compiling plural localization forms. This error is a regression from d191349.
Fixes #13346.
Notes
fr_FR.pluralFormsfield is now pre-compiled by build-translation.ts. To simplify review, this pull request includes only changes tolocales/index.jsand excludes the other updates made byyarn buildTranslations.parsePluralFormsfunction included aneslint-disable-next-line no-new-func. This seems to have been the only use ofno-new-func.git revert d1913493ab3a0850fafd14712508d8089f854cea. If this is done, it may still make sense to apply this pull request, since it resolves the "eventually we should automatically generate all the functions in advance in build-translations.ts" comment.Testing plan
Desktop (Fedora 42)
This pull request includes an automated Playwright test.