Skip to content

feat: update autologin translation - #10

Merged
ymijsters merged 3 commits into
mainfrom
update-autologin-translation
Jun 10, 2026
Merged

ymijsters merged 3 commits into
mainfrom
update-autologin-translation

Conversation

@ymijsters

@ymijsters ymijsters commented Jun 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Introduced auto-login functionality with improved language parameter detection from URLs.
  • Localization

    • Added comprehensive French translations for auto-login flows, including status messages and error handling.
    • Refined English welcome message text.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds URL-based language parameter support to the context provider and supplies auto-login UI translations for English and French. The context now reads the lang query parameter as a fallback when the current member is not an individual account type.

Changes

Auto-login Language Selection

Layer / File(s) Summary
URL language parameter fallback in context
src/contexts/CurrentMemberContext.tsx
useSearchParams is imported and the language selection logic is updated so that non-individual members fall back to the URL lang search parameter before using DEFAULT_LANG.
Auto-login UI localization strings
src/langs/en.json, src/langs/fr.json
English and French translation strings are added for auto-login UI, including welcome title, start button, error messages, and guidance for already-logged-in users. The English welcome title is also corrected by removing its trailing exclamation mark.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A hop through context and translation rhyme,
Language parameters flow with URL time,
French phrases join English in sync,
Welcome to auto-login—no exclamation to link! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main changes: updating autologin-related translations in French and English locale files, plus a context provider modification supporting the autologin feature.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch update-autologin-translation

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/langs/fr.json (1)

35-41: 💤 Low value

All translation keys are correctly added.

All seven AUTO_LOGIN_* keys match the English version. However, there's a minor punctuation inconsistency: AUTO_LOGIN_WELCOME_TITLE in French (line 39) has an exclamation mark "Bienvenue !" while the English version (en.json line 54) was changed to "Welcome" without an exclamation mark.

Consider aligning the punctuation style between languages for consistency.

✨ Suggested alignment for consistent tone
-  "AUTO_LOGIN_WELCOME_TITLE": "Bienvenue !",
+  "AUTO_LOGIN_WELCOME_TITLE": "Bienvenue",
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/langs/fr.json` around lines 35 - 41, The French translation for
AUTO_LOGIN_WELCOME_TITLE uses an exclamation mark ("Bienvenue !") which is
inconsistent with the English key (en.json) now set to "Welcome" without
punctuation; update the AUTO_LOGIN_WELCOME_TITLE value to "Bienvenue" (remove
the trailing "!") so the punctuation/tone matches across languages, keeping the
other AUTO_LOGIN_* keys unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/contexts/CurrentMemberContext.tsx`:
- Around line 30-33: The lang assignment allows an Individual account to yield
undefined and be passed to i18n.changeLanguage; update the computation of lang
(the variable set from query.data?.type, AccountType.Individual,
query.data?.extra?.lang, search.get('lang'), DEFAULT_LANG) so it uses a proper
fallback chain: use query.data?.extra?.lang if truthy, otherwise fall back to
search.get('lang') (if present), otherwise DEFAULT_LANG—e.g. replace the ternary
branch for AccountType.Individual with a nullish/coalescing check that
guarantees a non-undefined string before calling i18n.changeLanguage.

---

Nitpick comments:
In `@src/langs/fr.json`:
- Around line 35-41: The French translation for AUTO_LOGIN_WELCOME_TITLE uses an
exclamation mark ("Bienvenue !") which is inconsistent with the English key
(en.json) now set to "Welcome" without punctuation; update the
AUTO_LOGIN_WELCOME_TITLE value to "Bienvenue" (remove the trailing "!") so the
punctuation/tone matches across languages, keeping the other AUTO_LOGIN_* keys
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cd2732a2-ccde-407e-bc6a-a3787dd46247

📥 Commits

Reviewing files that changed from the base of the PR and between 6e99980 and 384dd12.

📒 Files selected for processing (3)
  • src/contexts/CurrentMemberContext.tsx
  • src/langs/en.json
  • src/langs/fr.json

Comment on lines 30 to +33
const lang =
query.data && query.data?.type === AccountType.Individual
query.data?.type === AccountType.Individual
? query.data?.extra?.lang
: DEFAULT_LANG;
: (search.get('lang') ?? DEFAULT_LANG);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Individual accounts without a language preference will set lang to undefined.

When query.data?.type === AccountType.Individual is true but query.data?.extra?.lang is undefined or null, the lang variable becomes undefined instead of falling back to the URL parameter or DEFAULT_LANG. This causes i18n.changeLanguage(undefined) to be called at line 36, which is incorrect.

The fallback chain should be: Individual account language preference → URL lang parameter → DEFAULT_LANG.

🔧 Proposed fix to ensure proper fallback chain
  // update language depending on user setting
  const lang =
-    query.data?.type === AccountType.Individual
-      ? query.data?.extra?.lang
-      : (search.get('lang') ?? DEFAULT_LANG);
+    query.data?.type === AccountType.Individual
+      ? (query.data?.extra?.lang ?? search.get('lang') ?? DEFAULT_LANG)
+      : (search.get('lang') ?? DEFAULT_LANG);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const lang =
query.data && query.data?.type === AccountType.Individual
query.data?.type === AccountType.Individual
? query.data?.extra?.lang
: DEFAULT_LANG;
: (search.get('lang') ?? DEFAULT_LANG);
// update language depending on user setting
const lang =
query.data?.type === AccountType.Individual
? (query.data?.extra?.lang ?? search.get('lang') ?? DEFAULT_LANG)
: (search.get('lang') ?? DEFAULT_LANG);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/contexts/CurrentMemberContext.tsx` around lines 30 - 33, The lang
assignment allows an Individual account to yield undefined and be passed to
i18n.changeLanguage; update the computation of lang (the variable set from
query.data?.type, AccountType.Individual, query.data?.extra?.lang,
search.get('lang'), DEFAULT_LANG) so it uses a proper fallback chain: use
query.data?.extra?.lang if truthy, otherwise fall back to search.get('lang') (if
present), otherwise DEFAULT_LANG—e.g. replace the ternary branch for
AccountType.Individual with a nullish/coalescing check that guarantees a
non-undefined string before calling i18n.changeLanguage.

@ymijsters
ymijsters merged commit 9096dd7 into main Jun 10, 2026
4 checks passed

This branch was previously deployed

1 inactive deployment
development — 384dd126 Deployed Jun 9, 2026 by ymijsters via Deploy to dev #31
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.

1 participant