Skip to content

Allow setting user locale when bulk adding project members#2168

Merged
myieye merged 3 commits intodevelopfrom
claude/fix-manageable-todo-5DELo
Feb 11, 2026
Merged

Allow setting user locale when bulk adding project members#2168
myieye merged 3 commits intodevelopfrom
claude/fix-manageable-todo-5DELo

Conversation

@myieye
Copy link
Collaborator

@myieye myieye commented Feb 11, 2026

Summary

This PR adds support for specifying a localization code when bulk adding project members, allowing newly created users to have their preferred language set during account creation rather than defaulting to English.

Key Changes

  • Frontend: Added DisplayLanguageSelect component to the bulk add members form, allowing users to select a locale for newly created members
  • Frontend: Updated BulkAddProjectMembers component to accept userLocale prop and pass the selected locale to the GraphQL mutation
  • Backend: Modified BulkAddProjectMembersInput record to include a Locale parameter with a default value of User.DefaultLocalizationCode
  • Backend: Updated ProjectMutations.BulkAddProjectMembers to use the provided locale instead of hardcoded "en"
  • GraphQL Schema: Added locale field to BulkAddProjectMembersInput with default value "en"

Implementation Details

  • The locale selection defaults to the current user's locale, providing a sensible default
  • The backend uses the provided locale when creating new user accounts via bulk add
  • The change maintains backward compatibility by providing a default locale value in the input record

https://claude.ai/code/session_01Hr9xWd97BEXEVMBUfrRF3c

When bulk-adding members to a project, newly created user accounts were
always assigned LocalizationCode = "en" regardless of the admin's locale.
This adds a Locale parameter (defaulting to "en") to BulkAddProjectMembersInput
and passes the current user's locale from the frontend.

https://claude.ai/code/session_01Hr9xWd97BEXEVMBUfrRF3c
The admin can now choose the display language for newly created users
via a dropdown, defaulting to the admin's own locale. Uses the same
DisplayLanguageSelect component as the register page and account
settings, which gracefully handles unsupported locale values.

https://claude.ai/code/session_01Hr9xWd97BEXEVMBUfrRF3c
@github-actions github-actions bot added the 📦 Lexbox issues related to any server side code, fw-headless included label Feb 11, 2026
@coderabbitai
Copy link

coderabbitai bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

Adds locale/localization support to the bulk project member addition feature. Backend mutation now uses configurable locale from input instead of hardcoded "en". Frontend introduces DisplayLanguageSelect component enabling users to choose locale during bulk member addition. Locale flows through the entire stack via GraphQL input.

Changes

Cohort / File(s) Summary
Backend Localization Support
backend/LexBoxApi/GraphQL/ProjectMutations.cs, backend/LexBoxApi/Models/Project/ProjectMemberInputs.cs
Added optional Locale parameter to BulkAddProjectMembersInput record with default value. Backend mutation now uses input.Locale instead of hardcoded "en" for LocalizationCode initialization.
Frontend GraphQL Schema
frontend/schema.graphql
Added new required locale: String! = "en" field to BulkAddProjectMembersInput input type, with default value aligned to backend.
Frontend Routing and Page
frontend/src/routes/(authenticated)/project/[project_code]/+page.svelte, frontend/src/routes/(authenticated)/project/[project_code]/+page.ts
Passed userLocale prop to BulkAddProjectMembers component. Removed local BulkAddProjectMembersInput type declaration (now sourced from generated schema).
Frontend Bulk Add Component
frontend/src/routes/(authenticated)/project/[project_code]/BulkAddProjectMembers.svelte
Added DisplayLanguageSelect import and integration. Extended component props with userLocale: string. Integrated locale field into form schema (defaulting to userLocale). Propagated locale through API payload and rendered language selector in UI.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Through forests of code both near and far,
A locale feature shines like a star! ✨
From backend to frontend, the changes align,
Users choose languages—how divine!
With DisplayLanguageSelect, options take flight,
Translation support now feels just right! 🌍

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: allowing users to specify a locale when bulk adding project members, which aligns with all file changes across frontend and backend.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, covering the key changes, implementation details, and rationale for the modifications across both frontend and backend components.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/fix-manageable-todo-5DELo

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
frontend/src/routes/(authenticated)/project/[project_code]/BulkAddProjectMembers.svelte (1)

31-36: userLocale captured non-reactively in schema default — matches ESLint warning.

The destructured userLocale on line 31 captures the initial prop value. The schema (line 32-36) is a module-level const, so .default(userLocale) will always use the value at component initialization time. If the prop were to change, the schema default wouldn't update.

This is likely fine in practice since user.locale won't change during this component's lifetime, but you can silence the ESLint warning and make intent clearer by using a closure or $derived:

Suggested approach
- const { projectId, userLocale }: Props = $props();
- const schema = z.object({
-   usernamesText: z.string().trim().min(1, $t('project_page.bulk_add_members.empty_user_field')),
-   password: passwordFormRules($t),
-   locale: z.string().trim().min(2).default(userLocale),
- });
+ const props: Props = $props();
+ const schema = $derived(z.object({
+   usernamesText: z.string().trim().min(1, $t('project_page.bulk_add_members.empty_user_field')),
+   password: passwordFormRules($t),
+   locale: z.string().trim().min(2).default(props.userLocale),
+ }));

Alternatively, if the current non-reactive behavior is intentional, add // eslint-disable-next-line svelte/valid-compile to suppress the warning explicitly.


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.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

UI unit Tests

 1 files  ±  0   3 suites   - 47   0s ⏱️ -22s
10 tests  - 128  10 ✅  - 128  0 💤 ±0  0 ❌ ±0 
10 runs   - 193  10 ✅  - 193  0 💤 ±0  0 ❌ ±0 

Results for commit d12c805. ± Comparison against base commit a43a321.

This pull request removes 138 and adds 10 tests. Note that renamed tests count towards both.
src/lib/components/stomp/stomp-guard.svelte.test.ts ‑ StompGuard > accepts parent values when not dirty
src/lib/components/stomp/stomp-guard.svelte.test.ts ‑ StompGuard > does NOT guard against stomping deep changes, because StompGuard can't detect them
src/lib/components/stomp/stomp-guard.svelte.test.ts ‑ StompGuard > ignores parent values when dirty
src/lib/components/stomp/stomp-guard.svelte.test.ts ‑ StompGuard > initializes with the parent value
src/lib/components/stomp/stomp-guard.svelte.test.ts ‑ StompGuard > keeps subscribers up to date when it becomes dirty
src/lib/components/stomp/stomp-guard.svelte.test.ts ‑ StompGuard > pushs changes to parent
src/lib/components/stomp/stomp-guard.svelte.test.ts ‑ StompGuard > reverts new parent values when ignored
src/lib/components/stomp/stomp-guard.svelte.test.ts ‑ StompGuard > starts accepting parent changes again after a flush
src/lib/components/ui/format/format-duration.test.ts ‑ formatDuration > formats durations
src/lib/components/ui/format/format-duration.test.ts ‑ formatDuration > formats durations with smallest unit
…
src/index.test.ts ‑ password hashing > can hash a pw using sha1
src/lib/i18n/i18n.test.ts ‑ buildRegionalLocaleRegex > should find all regional locales for available locales
src/lib/i18n/i18n.test.ts ‑ pickBestLocale > should return en by default
src/lib/i18n/i18n.test.ts ‑ pickBestLocale > should return en if no user locale is provided and acceptLanguageHeader does not have any supported locales
src/lib/i18n/i18n.test.ts ‑ pickBestLocale > should return regional locale from acceptLanguageHeader if it has a higher quality rating than the regionless locale
src/lib/i18n/i18n.test.ts ‑ pickBestLocale > should return supported locale from acceptLanguageHeader with highest quality rating if no user locale is provided
src/lib/i18n/i18n.test.ts ‑ pickBestLocale > should return user locale if acceptLanguageHeader does not provide a regional/more specific locale
src/lib/i18n/i18n.test.ts ‑ pickBestLocale > should return user locale if acceptLanguageHeader does not provide a regional/more specific locale with a higher quality rating
src/lib/i18n/i18n.test.ts ‑ pickBestLocale > should return user locale if acceptLanguageHeader is not provided
src/lib/user.test.ts ‑ jwtToUser > should convert a jwt token to a LexAuthUser

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 11, 2026

C# Unit Tests

146 tests   146 ✅  19s ⏱️
 22 suites    0 💤
  1 files      0 ❌

Results for commit d12c805.

♻️ This comment has been updated with latest results.

@myieye myieye marked this pull request as ready for review February 11, 2026 14:50
@myieye
Copy link
Collaborator Author

myieye commented Feb 11, 2026

Tested on develop ✅

@myieye myieye merged commit f267896 into develop Feb 11, 2026
27 checks passed
@myieye myieye deleted the claude/fix-manageable-todo-5DELo branch February 11, 2026 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📦 Lexbox issues related to any server side code, fw-headless included

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants