Skip to content

Comments

Backend/i18n: Consider empty translations as missing#7950

Open
tristanlabelle wants to merge 2 commits intodevelopfrom
backend/bugfix/i18next-empty-translations
Open

Backend/i18n: Consider empty translations as missing#7950
tristanlabelle wants to merge 2 commits intodevelopfrom
backend/bugfix/i18next-empty-translations

Conversation

@tristanlabelle
Copy link
Contributor

Weblate can write empty strings to translation files and expects the code to treat them as missing translations rather than as valid empty string translations. This happens with missing plural forms, for example:

  "attendees_count_one": "{{count}} participant",
  "attendees_count_many": "",
  "attendees_count_other": "{{count}} participants",

Testing

Added a test

Backend checklist

  • Added tests for any new code or added a regression test if fixing a bug
  • Run the backend locally and it works
  • Added migrations if there are any database changes, rebased onto develop if necessary for linear migration history

For maintainers

  • Maintainers can push commits to my branch
  • Maintainers can merge this PR for me

@vercel
Copy link

vercel bot commented Feb 21, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
couchers Ready Ready Preview Feb 22, 2026 0:01am

Request Review

# since this is how Weblate/i18next interpret it.
def test_fallback_on_empty_string():
i18next = I18Next()
en = i18next.add_language("en", PluralRules.en, json_dict={ "greeting": "hello" })
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note to self: will conflict with #7884

Copy link
Member

@aapeliv aapeliv left a comment

Choose a reason for hiding this comment

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

lgtm

@tristanlabelle tristanlabelle enabled auto-merge (squash) February 22, 2026 00:49
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.

2 participants