Interface language, time zone and formats per user in the admin, applied at start (A-41)

Aperta
#3,457 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp

Direzione di ricerca

Start with docs/planning/admin-technical-spec.md sections 3.1, 4.3, 4.17 and 10.8, then read the named preference and startup files, especially UserPreferences.cs, AdminHostBuilderExtensions.cs and AccountPreferences.razor. The issue describes changes across startup, formatting services, account settings, API behavior, tests and documentation, and depends on A-53. Done means meeting the listed acceptance checks, including applying saved preferences at startup and demonstrating format behavior in both the admin and a sample half.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area:admin area:localization type:feature

Problem

Row 3.18 asks for date and number formats per user, and section 4.17 for the interface culture of the user's preference. The Management API keeps both, and the admin uses half of it:

  • The API. GET and PUT /me/preferences keep culture, timeZone, dateFormat and numberFormat (#3096, merged on 15 Nov 2026 by #3138; src/FluentCMS.Core/Api/Management/OperationsEndpoints.cs, lines 81 and 82). The three cultures are culture names the server's platform knows and the time zone is an IANA id (src/FluentCMS.Core/Identity/UserPreferences.cs, lines 62 to 88). GET /me carries none of them, and a key or a service account gets 403.
  • The start does not read the choice (#3214). AddFluentCmsAdmin chooses the culture from NoInterfaceCulturePreference, which answers null, then the browser's, then the default (admin/src/FluentCMS.Admin/AdminHostBuilderExtensions.cs, lines 42 to 45). The preferences come after sign-in and the culture must be set before the host runs, so a copy in the browser is needed, and reading it that early takes an interop type that the allow-list of section 3.1 does not have.
  • Nothing writes three of the four. The account page offers the language, and only when more than one culture is offered (Account/AccountPreferences.razor, line 50). No page of the admin writes timeZone, dateFormat or numberFormat.
  • Two sources of formats. The shell applies the saved formats to FormatService after sign-in (Shell/AdminContext.cs, line 206), which the field editors, the list cells, the schedule, the version history and the sessions use. CultureInfo.CurrentCulture stays the browser's (AdminHostBuilderExtensions.cs, line 45), and these format with it: the counts of a list and of a bulk action (Content/ContentListPage.razor, line 544; Content/ListBulkActions.razor, line 271), the limit in a validation message (Content/FieldRules.cs, line 139), the wait of the rate limit notice (Api/RateLimitNotice.cs, line 31), a number in a text cell (FluentCMS.Admin.Abstractions/Lists/TextListCell.cs, line 39), and the texts with arguments of the wrapped set (FluentCMS.Admin.Components/Resources/CmsStrings.cs, line 37).
  • A half has no formats. FormatService is internal to FluentCMS.Admin, and the public API file of FluentCMS.Admin.Abstractions has no member for a format or a time zone. A page of a half cannot show a moment in the user's time zone. The pages of A6 show dates (deliveries, jobs, usage, sessions of a user); how each formats them is to be read when A6 is merged.
  • A write replaces every value, and the route has no ETag (UserPreferences.cs, lines 44 to 47). The account page reads again just before it writes (AccountPreferences.razor, lines 119 and 120), which narrows the window between two tabs and does not close it.

Proposal

  • The culture at start. The saved preference is the source. A copy in the browser serves the start: one key of localStorage that holds a culture name and nothing else, read before the host runs, by a storage type that joins the allow-list of 3.1. The preferences read after sign-in correct the copy, and a difference reloads the app once, in the saved culture, with unsaved drafts kept as an expired session keeps them. A user who chose none keeps the browser's culture, then the default. Sign-out keeps the copy.
  • The preferences card of the account page gains the time zone (the IANA zones the platform knows), the culture whose conventions dates and times follow, and the one numbers follow, each with "as the browser" for none and an example of a date, a time and a number as they will show. The language select shows when more than one culture is offered, as today, and a change of language reloads the app after the save.
  • One source of formats. When the preferences are applied, the current culture of the app becomes the user's: the culture of dates with the number format of the culture of numbers, so that every text formatted with the current culture follows. FluentCMS.Admin.Abstractions gains the formats as a service (a date, a time, a date and time, a number, and the id of the zone), which FormatService implements, for a half and for the administration assembly. The pages of A6 that show a moment use it.
  • A value the server refuses, a culture or a zone its platform does not know, is shown on its field.
  • One write per change. The read before the write stays until the Management API takes a change of one member (see the notes of the milestone); then the card sends that.

Acceptance

  • A user who chose a language sees the admin in it from the first paint of the next start, and on a new device after the first sign-in, with one reload; shown with a pseudo-culture of A-53 as the second language
  • A user chooses the time zone and the formats of dates and of numbers on the account page; a list, a form, the schedule, the version history and a page of administration show dates, times and numbers so after the save, without a reload
  • The count of a list, the limit in a validation message and a number in a text cell follow the format of numbers
  • A page of a half shows a moment in the user's time zone through the contract; the sample half of the tests proves it
  • A change of one preference in one tab does not undo a change of another made in a second tab
  • A key or a service account keeps the browser's formats, and a value the server refuses is named on its field
  • The card is usable by keyboard alone, and no text is hard-coded
  • Component tests cover the choice at start, the card and the formats; the API tests check the record against the OpenAPI document; an end-to-end case changes the language and the time zone and reloads
  • The allow-list of section 3.1 names the storage type, and 4.17 says what was built

Design: docs/planning/admin-technical-spec.md, sections 3.1, 4.3, 4.17 and 10.8 (A-41). Rows 3.18, 7.9. Closes #3214. Needs A-53, which takes the resources and the pseudo-cultures of the row in 10.8; #3096 is merged. Size: M.

Lingua principale
C#
Stelle
567
Fork
107
Merge medio
1h 19m
PR unite (30g)
353

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di fluentcms/FluentCMS

Tutte le issue di fluentcms/FluentCMS

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.