Skip to content

add i18n support - #6796

Open
benedikt-bartscher wants to merge 150 commits into
reflex-dev:mainfrom
benedikt-bartscher:add-i18n
Open

benedikt-bartscher wants to merge 150 commits into
reflex-dev:mainfrom
benedikt-bartscher:add-i18n

Conversation

@benedikt-bartscher

@benedikt-bartscher benedikt-bartscher commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

closes #2339

@codspeed

codspeed Bot commented Jul 17, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 4%

2 warnings

⚠️ 15 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ 1 benchmark with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

❌ 1 regressed benchmark
✅ 145 untouched benchmarks
⏩ 8 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ test_state_access[write_own] 123.4 ms 128.6 ms -4%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing benedikt-bartscher:add-i18n (048893a) with main (6f5c39c)

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@greptile-apps

greptile-apps Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The latest change appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[High impact] The latest change appears safe to merge.

Summary

Adds optional internationalization through reflex-i18n, including browser and server translations, locale-based routes, formatting helpers, and catalog commands.

  • Reflex apps can translate component and state text using a visitor’s active language.
  • Reflex can serve each app page under a locale-specific URL.
  • The reflex i18n command can create and check translation catalogs.
  • Memoized component hooks and state dependencies stay tied to the right owner.

Reviews (91) · Last reviewed commit: "chore(i18n): drop the TODO about dev flo..." · Reviewed by Greptile

Comment thread reflex/__init__.py Resolved
@benedikt-bartscher
benedikt-bartscher marked this pull request as ready for review July 18, 2026 11:09
@benedikt-bartscher
benedikt-bartscher requested review from a team and Alek99 as code owners July 18, 2026 11:09
@benedikt-bartscher benedikt-bartscher changed the title first i18n wip add basic i18n support Jul 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6b9a5f5342

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread packages/reflex-i18n/pyproject.toml Resolved
Comment thread reflex/reflex.py Resolved
@benedikt-bartscher benedikt-bartscher changed the title add basic i18n support add i18n support Jul 18, 2026
@benedikt-bartscher

Copy link
Copy Markdown
Contributor Author

@masenf could you please take a brief look at this from an architectural design and DX perspective? it's totally okay if you have smth completly different in mind

@masenf masenf 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.

@benedikt-bartscher thanks for adding this and sorry for the review back-up. i did an initial look and i think the added extension points make sense and the API feels nice.

one potential issue i see affects SEO performance of the SSG static versions of the site -- since the translation depends on state, other languages might not be indexable by crawlers.

Comment thread tests/units/reflex_i18n/test_catalog.py Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 14 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/reflex-i18n/src/reflex_i18n/plugin.py">

<violation number="1" location="packages/reflex-i18n/src/reflex_i18n/plugin.py:202">
P2: Plain page metadata strings are translated here without registering their msgids, so the catalog compiler does not include them in the generated catalogs. Register these metadata messages during evaluation (or otherwise include them in catalog extraction) so newly added titles, descriptions, and meta content receive translations through the normal i18n workflow.</violation>
</file>

<file name="packages/reflex-i18n/src/reflex_i18n/cli.py">

<violation number="1" location="packages/reflex-i18n/src/reflex_i18n/cli.py:399">
P2: `_CREATION_DATE_RE` is applied to the entire PO file, not just its header. A multiline message with a continuation line matching `POT-Creation-Date: ...` can therefore make `_write_catalog` return without writing a changed catalog; restrict the date normalization to the header block before comparing.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 16 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/reflex-i18n/src/reflex_i18n/catalog.py">

<violation number="1" location="packages/reflex-i18n/src/reflex_i18n/catalog.py:297">
P2: This parameter promises to accept arbitrary `Mapping` implementations, but `json.dumps` only handles concrete dictionaries here. Convert the outer and nested mappings to dictionaries before serialization, or narrow the annotation to `dict`.</violation>
</file>

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread docs/i18n/overview.md Resolved

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 9 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

Comment thread docs/i18n/overview.md Resolved
… paths case-insensitively and never redirect another page's URL

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 14 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

View guided diff | Re-trigger cubic

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement Anything you want improved roadmap https://github.com/reflex-dev/reflex/issues/2727

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Internationalization (I18N) and localization (L10N) (Feature Request)

3 participants