Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export interface EntryFormProps {
onDelete?: () => void;
/** Callback when form is cancelled */
onCancel?: () => void;
/** Active content locale (i18n M7) — saves target this language. */
/** Active content locale — saves target this language. */
locale?: string;
/**
* Whether the parent read this entry with the working-draft overlay (`draft`).
Expand All @@ -117,10 +117,10 @@ export interface EntryFormProps {
* collection); an embedded editor reading the live row passes `false`.
*/
readDraft?: boolean;
/** Called when the user switches the active content language (i18n M7). */
/** Called when the user switches the active content language. */
onLocaleChange?: (locale: string, options?: { seedFrom?: string }) => void;
/**
* Default-language field values (i18n M7). Provided while translating a non-default language
* Default-language field values. Provided while translating a non-default language
* so each translatable field can show its source text inline. Keyed by field name (camelCase).
*/
sourceValues?: Record<string, unknown>;
Expand Down Expand Up @@ -329,7 +329,7 @@ export function EntryForm({
onCancel,
});

// i18n M7: content-locale context for field components — the active locale's writing
// Content-locale context for field components — the active locale's writing
// direction (RTL for Arabic/Hebrew/…), the collection's master localization switch (so a
// field can tell whether it is translatable), and whether the active language differs from
// the app default (per-field affordances only apply while translating a non-default language).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ export interface EntrySystemHeaderProps {
entry?: EntryData | null;
/** Collection slug for the Show JSON dialog. */
collectionSlug: string;
/** Active content locale (i18n M7). Shown/selected in the language switcher. */
/** Active content locale. Shown/selected in the language switcher. */
locale?: string;
/** Called when the user switches the active content language (i18n M7). When omitted, the
/** Called when the user switches the active content language. When omitted, the
* language switcher is not rendered. */
/** Whether the entity is localized. Forwarded to the version-history panel as
* the authoritative signal for its locale filter (shared writes can produce
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export function DocumentPanel({
hasWorkingDraft
);

// i18n M7: per-language translation-status pills (spec §10). Present only when the entry was
// Per-language translation-status pills. Present only when the entry was
// fetched with `?translation-status=1` on a localized collection; inert otherwise.
const translations = entry?._translations as
| Record<string, { translated: boolean; status?: string }>
Expand Down Expand Up @@ -150,7 +150,7 @@ export function DocumentPanel({
}

/**
* Per-language translation-status pills row (i18n M7). Renders nothing when localization is off
* Per-language translation-status pills row. Renders nothing when localization is off
* or the entry has no `_translations` map, so non-localized documents are unchanged.
*/
function TranslationsRow({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export interface UseEntryFormOptions {
onDelete?: () => void;
/** Callback when form is cancelled */
onCancel?: () => void;
/** Active content locale (i18n M7) — the update targets this language's values. */
/** Active content locale — the update targets this language's values. */
locale?: string;
/**
* Whether the entry was READ with the working-draft overlay (`draft`), so the
Expand Down Expand Up @@ -459,7 +459,7 @@ export function useEntryForm({
entryId: entry?.id ?? "",
showToast: true,
setError: form.setError,
// i18n M7: route the save to the active content language.
// Route the save to the active content language.
locale,
// Match the editor's read mode so the optimistic update, rollback, and
// cancelQueries key onto the same cached document the form is showing. The
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function toCollectionForColumns(
// Forward the Draft / Published flag so the bulk-action bar can
// surface Publish / Unpublish only for collections that opted in.
status: collection.status === true,
// i18n M7: forward the localization flag so the table can render a
// Forward the localization flag so the table can render a
// per-row translation-completeness column.
localized: collection.localized === true,
admin: {
Expand Down Expand Up @@ -251,7 +251,7 @@ export function EntryList({ collectionSlug }: EntryListProps) {
const [createdTo, setCreatedTo] = useState("");
const [updatedFrom, setUpdatedFrom] = useState("");
const [updatedTo, setUpdatedTo] = useState("");
// i18n M7: the active language filter (locale + translation state), or null.
// The active language filter (locale + translation state), or null.
const [translationFilter, setTranslationFilter] =
useState<TranslationListFilter | null>(null);

Expand Down Expand Up @@ -298,7 +298,7 @@ export function EntryList({ collectionSlug }: EntryListProps) {
);
usePluginAutoRegistration(collectionsForRegistration);

// i18n M7: request the per-locale translation-status overview only for localized collections
// Request the per-locale translation-status overview only for localized collections
// on a localization-enabled app — drives the list's translation-completeness column.
const { enabled: localizationEnabled } = useLocalization();
const wantsTranslationStatus =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ export interface EntryTableProps {
status?: string;
/** Callback when status filter changes */
onStatusChange?: (status: string) => void;
/** i18n M7: active language filter (locale + translation state), or null. */
/** Active language filter (locale + translation state), or null. */
translationFilter?: TranslationListFilter | null;
/** i18n M7: callback when the language filter changes. */
/** Callback when the language filter changes. */
onTranslationFilterChange?: (filter: TranslationListFilter | null) => void;
/** Created date lower bound (YYYY-MM-DD) */
createdFrom?: string;
Expand Down Expand Up @@ -336,7 +336,7 @@ export const EntryTable = forwardRef<EntryTableRef, EntryTableProps>(
!!onUpdatedFromChange ||
!!onUpdatedToChange;

// i18n M7: the language filter is available on a localized collection when the app has
// The language filter is available on a localized collection when the app has
// localization configured (more than one language).
const {
enabled: localizationEnabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export function getAvailableColumns(
// These columns are always available as built-ins
const builtInColumns = ["id", "title", "slug", "createdAt", "updatedAt"];

// i18n M7: translation-completeness column, only for localized collections.
// Translation-completeness column, only for localized collections.
if (collection.localized) {
builtInColumns.push("translations");
}
Expand Down Expand Up @@ -246,7 +246,7 @@ export function getDefaultVisibleColumns(
orderedDataColumns.push("createdAt");
orderedDataColumns.push("updatedAt");

// 5. i18n M7: translation-completeness column for localized collections.
// 5. Translation-completeness column for localized collections.
if (collection.localized) {
orderedDataColumns.push("translations");
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** i18n M7 translation-status list filter: keep entries in a given state for a locale. */
/** Translation-status list filter: keep entries in a given state for a locale. */
export interface TranslationListFilter {
locale: string;
state: "missing" | "translated" | "draft" | "published";
Expand All @@ -11,7 +11,7 @@ export interface EntryFilterState {
createdTo?: string;
updatedFrom?: string;
updatedTo?: string;
/** i18n M7: the active language filter, if any. */
/** The active language filter, if any. */
translated?: TranslationListFilter | null;
}

Expand Down Expand Up @@ -76,7 +76,7 @@ export function buildEntryWhereFilter({
else if (filters.length === 1) result = filters[0];
else result = { and: filters };

// i18n M7: attach the language filter as a TOP-LEVEL reserved `_translated` key (the backend
// Attach the language filter as a TOP-LEVEL reserved `_translated` key (the backend
// extractor only reads it at the top level, never nested inside `and`).
if (translated) {
result = { ...(result ?? {}), _translated: translated };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* EntryLocaleContext — carries the entry editor's active content language down to field
* components (i18n M7), so a field can render its input in the language's writing direction
* components, so a field can render its input in the language's writing direction
* without threading the locale through every prop.
*
* Default is a non-localized editor (`rtl: false`), so components using fields outside a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export function FieldWrapper({
horizontal = false,
editorIsOpaque = false,
}: FieldWrapperProps) {
// i18n M7: active content-language direction (RTL for Arabic/Hebrew/…).
// Active content-language direction (RTL for Arabic/Hebrew/…).
const entryLocale = useEntryLocale();
// Generate unique IDs for accessibility
const generatedId = useId();
Expand Down Expand Up @@ -257,7 +257,7 @@ export function FieldWrapper({
.filter(Boolean)
.join(" ") || undefined;

// i18n M7: is this field translatable (a per-language value) or shared across all languages?
// Is this field translatable (a per-language value) or shared across all languages?
// Uses the same classifier as storage generation (nextly/config) so the editor and the DB
// agree. For non-localized collections this is always false and everything below is inert.
const isLocalizedField = isFieldLocalized(
Expand Down Expand Up @@ -295,7 +295,7 @@ export function FieldWrapper({
</span>
) : null;

// i18n M7: while translating a non-default language, show the default-language value inline on
// While translating a non-default language, show the default-language value inline on
// a translatable field so the translator always has the source text (spec §10 — the validated,
// cheap alternative to a full side-by-side editor). Only primitive (text/number) sources render;
// structural values (relationships, richText objects) are skipped.
Expand Down Expand Up @@ -348,7 +348,7 @@ export function FieldWrapper({
style={fieldWithCommonProps.admin?.style}
data-field={fieldName}
data-field-type={field.type}
// i18n M7: render the field right-to-left when a translatable field is edited in an RTL language.
// Render the field right-to-left when a translatable field is edited in an RTL language.
{...(rtlField ? { dir: "rtl" as const } : {})}
>
<div className="pt-0.5">{children}</div>
Expand Down Expand Up @@ -413,7 +413,7 @@ export function FieldWrapper({
style={fieldWithCommonProps.admin?.style}
data-field={fieldName}
data-field-type={field.type}
// i18n M7: render the field right-to-left when a translatable field is edited in an RTL
// Render the field right-to-left when a translatable field is edited in an RTL
// language (Arabic, Hebrew, …). Shared / non-localized editors are unaffected.
{...(rtlField ? { dir: "rtl" as const } : {})}
// A field with no single focusable control is exposed as a named group.
Expand Down Expand Up @@ -473,7 +473,7 @@ export function FieldWrapper({
</Label>
)}

{/* i18n M7: the default language's value, shown while translating another
{/* The default language's value, shown while translating another
language. It sits ABOVE the input because it is what the translator
reads FROM: source first, then the box they type the translation into.
Below the input it read as a footnote about the field rather than as
Expand Down
4 changes: 2 additions & 2 deletions packages/admin/src/hooks/queries/useEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface UseEntryOptions<T = Entry> {
/** Fallback locale when translation is missing */
fallbackLocale?: string;
/**
* i18n M7: request the per-locale `_translations` overview map (which languages are translated
* Request the per-locale `_translations` overview map (which languages are translated
* + each one's draft/published status) for the per-language status pills.
*/
translationStatus?: boolean;
Expand Down Expand Up @@ -168,7 +168,7 @@ export function useEntry<T = Entry>({
queryOptions,
}: UseEntryOptions<T>) {
return useQuery<T, Error>({
// i18n M7: locale is part of the cache identity — switching languages must refetch the
// Locale is part of the cache identity — switching languages must refetch the
// entry (the localized field values differ per locale), not serve the previous language.
// The cache identity is built through the shared `detailScoped` helper so the
// mutation hook's optimistic-update key stays in lockstep with this read key.
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/hooks/queries/useUpdateEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export interface UseUpdateEntryOptions<
* When provided, field-level errors from the server will be set on corresponding form fields.
*/
setError?: UseFormSetError<TFieldValues>;
/** Content locale (i18n M7) — the update targets this language's translatable values. */
/** Content locale — the update targets this language's translatable values. */
locale?: string;
/** Fallback locale when a translation is missing. */
fallbackLocale?: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/src/hooks/useLocalization.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* useLocalization — admin-side access to the app's content-localization config (i18n M7).
* useLocalization — admin-side access to the app's content-localization config.
*
* Reads the localization block from admin-meta (surfaced on branding). Returns a small, stable
* surface the entry editor uses to render the language switcher and resolve per-locale metadata
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// i18n M7: the schema builder's Localized flags must survive serialization end-to-end —
// The schema builder's Localized flags must survive serialization end-to-end —
// per-field advanced.localized and the collection-level i18n toggle.

import { describe, it, expect } from "vitest";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export default function EditEntryPage({
const slug = params?.slug;
const id = params?.id;

// i18n M7: active content language for this editor. `undefined` = the app's default locale
// Active content language for this editor. `undefined` = the app's default locale
// (the backend resolves it). Switching triggers a refetch (useEntry is keyed by locale) and
// routes saves to the chosen language (EntryForm → useUpdateEntry).
const { locale, changeLocale, resetLocale, seedFromLocale, clearSeed } =
Expand All @@ -247,7 +247,7 @@ export default function EditEntryPage({

// Fetch entry data with relationship expansion
// depth: 2 ensures relationship fields include display labels (title, name, etc.)
// i18n M7: on a localized app, request the per-locale translation-status overview so the editor
// On a localized app, request the per-locale translation-status overview so the editor
// can show per-language status pills. Inert (param omitted) for non-localized apps.
const { defaultLocale, enabled: localizationEnabled } = useLocalization();

Expand All @@ -273,7 +273,7 @@ export default function EditEntryPage({
translationStatus: localizationEnabled,
});

// i18n M7: while translating a non-default language, also load the default-language entry so
// While translating a non-default language, also load the default-language entry so
// the editor can show the source text inline on each translatable field (spec §10). Gated so
// it only fires when actually translating another language; editing the default language reuses
// the primary fetch above (same cache key) and needs no source copy.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// i18n M7: entryApi.update forwards the content locale as `?locale=` so an edit in the admin's
// entryApi.update forwards the content locale as `?locale=` so an edit in the admin's
// active language updates only that language's translatable values.

import { describe, expect, it, vi, beforeEach } from "vitest";
Expand Down
14 changes: 7 additions & 7 deletions packages/admin/src/services/entryApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export interface FindParams {
/** Fallback locale when translation is missing */
fallbackLocale?: string;
/**
* i18n M7: request the per-locale `_translations` overview map on each row (which languages
* Request the per-locale `_translations` overview map on each row (which languages
* are translated + each one's draft/published status). Sent as `?translation-status=1`.
*/
translationStatus?: boolean;
Expand All @@ -78,7 +78,7 @@ export interface CountParams {
/** Query filters using Nextly where syntax */
where?: Record<string, unknown>;
/**
* Content locale (i18n M4). Keeps the count in parity with a locale-scoped list — a
* Content locale. Keeps the count in parity with a locale-scoped list — a
* localized where/search filters within this language, so the total must match the rows.
*/
locale?: string;
Expand Down Expand Up @@ -338,7 +338,7 @@ export const buildFindQuery = (params: FindParams): string => {
// fall back to the default language.
query.set("fallback-locale", params.fallbackLocale);
}
// i18n M7: opt into the per-locale translation-status overview map.
// Opt into the per-locale translation-status overview map.
if (params.translationStatus) {
query.set("translation-status", "1");
}
Expand Down Expand Up @@ -505,7 +505,7 @@ export const entryApi = {
if (options?.fallbackLocale)
query.set("fallback-locale", options.fallbackLocale);
if (options?.draft !== undefined) query.set("draft", String(options.draft));
// i18n M7: opt into the per-locale translation-status overview map.
// Opt into the per-locale translation-status overview map.
if (options?.translationStatus) query.set("translation-status", "1");
// Why: admin context is trusted (the route is gated by
// requireCollectionAccess). Pass `status=all` so the server's default
Expand Down Expand Up @@ -566,7 +566,7 @@ export const entryApi = {
if (params.where && Object.keys(params.where).length > 0) {
query.set("where", JSON.stringify(params.where));
}
// i18n M4: forward the content locale so a locale-scoped count matches the list.
// Forward the content locale so a locale-scoped count matches the list.
if (params.locale) {
query.set("locale", params.locale);
}
Expand Down Expand Up @@ -640,7 +640,7 @@ export const entryApi = {
data: UpdateEntryPayload,
options?: Pick<FindParams, "locale" | "fallbackLocale">
): Promise<MutationResult<Entry>> => {
// i18n M7: `?locale=de` updates only the German translatable values for this entry.
// `?locale=de` updates only the German translatable values for this entry.
const query = new URLSearchParams();
if (options?.locale) query.set("locale", options.locale);
if (options?.fallbackLocale)
Expand Down Expand Up @@ -814,7 +814,7 @@ export const entryApi = {
},

/**
* i18n M7: publish every language of an entry at once (spec §10).
* Publish every language of an entry at once.
* Hits `POST /api/collections/{slug}/entries/{id}/publish-all`.
*/
publishAllLocales: async (
Expand Down
4 changes: 2 additions & 2 deletions scripts/check-comment-convention.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ describe("the allowlist", () => {
// entries without removing or lowering any, one more when it learned the bracketed form, and one
// more when patterns began reading normalised text and a label wrapped across lines became
// visible. A raise for any other reason is the silencing this guards against.
const EXPECTED_ENTRIES = 244;
const EXPECTED_TOTAL = 551;
const EXPECTED_ENTRIES = 228;
const EXPECTED_TOTAL = 507;

it("matches its pinned size exactly", () => {
expect(readAllowlist().size).toBe(EXPECTED_ENTRIES);
Expand Down
Loading
Loading