Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(richtext): translate the editor toolbar, link dialog, and Tab escape hint (#7215)

Cindy Zhang11a80dd007f8
diff --git a/.changeset/richtext-editor-i18n-catalog.md b/.changeset/richtext-editor-i18n-catalog.md
new file mode 100644
index 0000000000..08a2f37869
--- /dev/null
+++ b/.changeset/richtext-editor-i18n-catalog.md
@@ -0,0 +1,7 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] Added a `@astryx.richTextEditor.*` catalog namespace to the shared message catalog, so the RichText editor's toolbar labels, block-format options, link dialog, and Tab escape hint can be translated and overridden through `InternationalizationProvider`. The editor's character counter now announces through the existing `@astryx.textArea.characters*` messages, so it is translated in every locale TextArea already ships.
+
+@cixzhang @AKnassa
diff --git a/eslint.config.js b/eslint.config.js
index 01fbf8de83..9b04cba5f3 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -825,9 +825,9 @@ export default defineConfig(
// off. Must come last so it overrides the blocks above.
//
// The package was outside these rules until now, so turning them on finds
- // drift that predates this scope change: 25 untranslatable strings, four
- // props missing `ref`, and six smaller API-shape items. Failing CI on work
- // nobody has had the chance to do would mean either reverting the scope or
+ // drift that predates this scope change: four props missing `ref` and six
+ // smaller API-shape items. Failing CI on work nobody has had the chance to
+ // do would mean either reverting the scope or
// landing a very large mixed change, so each one stays visible as a warning
// and is tracked separately. Everything the package is ALREADY clean on —
// the token and DOM rules, `no-classname-clobber`, `no-physical-properties`,
@@ -839,8 +839,6 @@ export default defineConfig(
{
files: ['packages/richtext/src/**/*.{ts,tsx}'],
rules: {
- // Every user- and AT-facing string in the toolbar is a literal.
- '@astryx/no-hardcoded-i18n-string': 'warn',
// React 19 ref-in-props migration for the editor's public props.
'@astryx/require-ref-prop': 'warn',
'@eslint-react/no-forward-ref': 'warn',
diff --git a/packages/core/locales/en.json b/packages/core/locales/en.json
index d1a856ad57..9e2096c626 100644
--- a/packages/core/locales/en.json
+++ b/packages/core/locales/en.json
@@ -535,6 +535,122 @@
"defaultMessage": "Copy link to {heading}",
"description": "Accessible name on the Markdown heading copy button in its default state. `{heading}` is the heading's plain text, or its generated id when the text is empty; pairs with `markdownHeadingLinks.copied`."
},
+ "@astryx.richTextEditor.tabEscapeHint": {
+ "defaultMessage": "Press Escape then Tab to move focus out of the editor.",
+ "description": "Screen-reader-only hint attached to the RichTextEditor text area. Tab indents text inside the editor, so this tells keyboard users the two-key sequence that moves focus out of it."
+ },
+ "@astryx.richTextEditor.toolbar.label": {
+ "defaultMessage": "Text formatting",
+ "description": "Accessible name of the formatting toolbar above a RichTextEditor."
+ },
+ "@astryx.richTextEditor.toolbar.actions": {
+ "defaultMessage": "Formatting actions",
+ "description": "Accessible name of the group that holds every formatting control in the RichTextEditor toolbar."
+ },
+ "@astryx.richTextEditor.toolbar.undo": {
+ "defaultMessage": "Undo",
+ "description": "Label and tooltip of the toolbar button that undoes the last edit in a RichTextEditor."
+ },
+ "@astryx.richTextEditor.toolbar.redo": {
+ "defaultMessage": "Redo",
+ "description": "Label and tooltip of the toolbar button that redoes the last undone edit in a RichTextEditor."
+ },
+ "@astryx.richTextEditor.toolbar.historyDivider": {
+ "defaultMessage": "History and block formats",
+ "description": "Screen-reader name of the divider between the undo/redo buttons and the block-format menu in the RichTextEditor toolbar."
+ },
+ "@astryx.richTextEditor.toolbar.blockFormat": {
+ "defaultMessage": "Block format",
+ "description": "Visually hidden label of the RichTextEditor toolbar menu that turns the current block into a paragraph, heading, list, or quote."
+ },
+ "@astryx.richTextEditor.toolbar.formatDivider": {
+ "defaultMessage": "Block and inline formats",
+ "description": "Screen-reader name of the divider between the block-format menu and the bold/italic/etc. buttons in the RichTextEditor toolbar."
+ },
+ "@astryx.richTextEditor.toolbar.paragraph": {
+ "defaultMessage": "Paragraph",
+ "description": "Block-format menu option: plain body text."
+ },
+ "@astryx.richTextEditor.toolbar.heading1": {
+ "defaultMessage": "Heading 1",
+ "description": "Block-format menu option: top-level heading."
+ },
+ "@astryx.richTextEditor.toolbar.heading2": {
+ "defaultMessage": "Heading 2",
+ "description": "Block-format menu option: second-level heading."
+ },
+ "@astryx.richTextEditor.toolbar.heading3": {
+ "defaultMessage": "Heading 3",
+ "description": "Block-format menu option: third-level heading."
+ },
+ "@astryx.richTextEditor.toolbar.bulletedList": {
+ "defaultMessage": "Bulleted list",
+ "description": "Block-format menu option: a list whose items start with bullet markers."
+ },
+ "@astryx.richTextEditor.toolbar.numberedList": {
+ "defaultMessage": "Numbered list",
+ "description": "Block-format menu option: a list whose items are numbered."
+ },
+ "@astryx.richTextEditor.toolbar.blockQuote": {
+ "defaultMessage": "Block quote",
+ "description": "Block-format menu option: an indented quotation block."
+ },
+ "@astryx.richTextEditor.toolbar.bold": {
+ "defaultMessage": "Bold",
+ "description": "Label of the toolbar toggle that makes selected text bold."
+ },
+ "@astryx.richTextEditor.toolbar.italic": {
+ "defaultMessage": "Italic",
+ "description": "Label of the toolbar toggle that makes selected text italic."
+ },
+ "@astryx.richTextEditor.toolbar.underline": {
+ "defaultMessage": "Underline",
+ "description": "Label of the toolbar toggle that underlines selected text."
+ },
+ "@astryx.richTextEditor.toolbar.strikethrough": {
+ "defaultMessage": "Strikethrough",
+ "description": "Label of the toolbar toggle that strikes a line through selected text."
+ },
+ "@astryx.richTextEditor.toolbar.inlineCode": {
+ "defaultMessage": "Inline code",
+ "description": "Label of the toolbar toggle that formats selected text as source code inside a sentence."
+ },
+ "@astryx.richTextEditor.toolbar.link": {
+ "defaultMessage": "Link",
+ "description": "Label of the toolbar toggle that opens the dialog to add or edit a link on selected text."
+ },
+ "@astryx.richTextEditor.link.insertTitle": {
+ "defaultMessage": "Insert link",
+ "description": "Title of the RichTextEditor dialog that adds a new link."
+ },
+ "@astryx.richTextEditor.link.editTitle": {
+ "defaultMessage": "Edit link",
+ "description": "Title of the RichTextEditor dialog that changes or removes an existing link."
+ },
+ "@astryx.richTextEditor.link.url": {
+ "defaultMessage": "URL",
+ "description": "Label of the web address field in the RichTextEditor link dialog."
+ },
+ "@astryx.richTextEditor.link.invalidUrl": {
+ "defaultMessage": "Enter a valid http, https, mailto, or tel URL.",
+ "description": "Error under the link dialog address field when the entered address is not allowed. Keep the scheme names http, https, mailto, and tel untranslated."
+ },
+ "@astryx.richTextEditor.link.remove": {
+ "defaultMessage": "Remove link",
+ "description": "Button in the RichTextEditor link dialog that removes the link from the selected text and keeps the text."
+ },
+ "@astryx.richTextEditor.link.cancel": {
+ "defaultMessage": "Cancel",
+ "description": "Button that closes the RichTextEditor link dialog without changing anything."
+ },
+ "@astryx.richTextEditor.link.add": {
+ "defaultMessage": "Add link",
+ "description": "Submit button of the RichTextEditor link dialog when adding a new link."
+ },
+ "@astryx.richTextEditor.link.update": {
+ "defaultMessage": "Update link",
+ "description": "Submit button of the RichTextEditor link dialog when changing an existing link address."
+ },
"@astryx.markdown.taskList": {
"defaultMessage": "Task list",
"description": "Screen-reader-only accessible name for a GitHub-flavored Markdown task list (rendered from `- [ ] item` / `- [x] done` syntax)."
diff --git a/packages/richtext/src/RichTextEditor.doc.mjs b/packages/richtext/src/RichTextEditor.doc.mjs
index 1c5d69804a..41a10b71e0 100644
--- a/packages/richtext/src/RichTextEditor.doc.mjs
+++ b/packages/richtext/src/RichTextEditor.doc.mjs
@@ -135,8 +135,9 @@ export const docs = {
name: 'tabEscapeHint',
type: 'string',
description:
- 'Screen-reader hint describing how to move focus out of the editor, since Tab is bound to indentation (press Escape, then Tab). Visually hidden, wired via aria-describedby. Override to localize; pass "" to omit.',
- default: "'Press Escape then Tab to move focus out of the editor.'",
+ 'Screen-reader hint describing how to move focus out of the editor, since Tab is bound to indentation (press Escape, then Tab). Visually hidden, wired via aria-describedby. Translated for the active locale; override to change the text, or pass "" to omit.',
+ default:
+ "'Press Escape then Tab to move focus out of the editor.' (translated)",
},
{
name: 'maxLength',
diff --git a/packages/richtext/src/RichTextEditor.test.tsx b/packages/richtext/src/RichTextEditor.test.tsx
index 485f57f3f3..e07e5c1422 100644
--- a/packages/richtext/src/RichTextEditor.test.tsx
+++ b/packages/richtext/src/RichTextEditor.test.tsx
@@ -41,6 +41,7 @@ import {
} from './markdownSerializers';
import {RichTextEditorToolbar} from './RichTextEditorToolbar';
import {registerIcons, resetIcons} from '@astryxdesign/core/Icon';
+import {InternationalizationProvider} from '@astryxdesign/core/i18n';
import {
RichTextEditorAutoLinkPlugin,
DEFAULT_LINK_MATCHERS,
@@ -828,7 +829,7 @@ describe('RichTextEditor', () => {
);
await waitFor(() => expect(screen.getByText('11/5')).toBeInTheDocument());
// aria-live region announces the overflow for screen readers.
- expect(screen.getByText('6 characters over limit')).toBeInTheDocument();
+ expect(screen.getByText('6 characters over the limit')).toBeInTheDocument();
});
it('associates the counter with the editor via aria-describedby', async () => {
@@ -2071,3 +2072,53 @@ describe('toolbar follows the editable props after mount', () => {
expect(screen.getByRole('button', {name: 'Bold'})).toBeDisabled();
});
});
+
+describe('RichTextEditor translation', () => {
+ const FRENCH = {
+ fr: {
+ '@astryx.richTextEditor.toolbar.label': 'Mise en forme',
+ '@astryx.richTextEditor.toolbar.bold': 'Gras',
+ '@astryx.richTextEditor.toolbar.undo': 'Annuler',
+ '@astryx.richTextEditor.toolbar.blockFormat': 'Format du bloc',
+ '@astryx.richTextEditor.tabEscapeHint':
+ 'Appuyez sur Échap puis Tab pour quitter l’éditeur.',
+ },
+ };
+
+ it('routes the toolbar and the Tab escape hint through the active locale', () => {
+ render(
+ <InternationalizationProvider locale="fr" overrides={FRENCH}>
+ <RichTextEditor label="Notes" toolbar={<RichTextEditorToolbar />} />
+ </InternationalizationProvider>,
+ );
+
+ expect(
+ screen.getByRole('toolbar', {name: 'Mise en forme'}),
+ ).toBeInTheDocument();
+ expect(screen.getByRole('button', {name: 'Gras'})).toBeInTheDocument();
+ expect(screen.getByRole('button', {name: 'Annuler'})).toBeInTheDocument();
+ expect(screen.getByText('Format du bloc')).toBeInTheDocument();
+ expect(screen.getByRole('textbox')).toHaveAccessibleDescription(
+ 'Appuyez sur Échap puis Tab pour quitter l’éditeur.',
+ );
+ });
+
+ it('keeps caller-provided text over the translated defaults', () => {
+ render(
+ <InternationalizationProvider locale="fr" overrides={FRENCH}>
+ <RichTextEditor
+ label="Notes"
+ tabEscapeHint="Custom hint"
+ toolbar={<RichTextEditorToolbar label="Custom toolbar" />}
+ />
+ </InternationalizationProvider>,
+ );
+
+ expect(
+ screen.getByRole('toolbar', {name: 'Custom toolbar'}),
+ ).toBeInTheDocument();
+ expect(screen.getByRole('textbox')).toHaveAccessibleDescription(
+ 'Custom hint',
+ );
+ });
+});
diff --git a/packages/richtext/src/RichTextEditor.tsx b/packages/richtext/src/RichTextEditor.tsx
index 70560ba784..ca87459876 100644
--- a/packages/richtext/src/RichTextEditor.tsx
+++ b/packages/richtext/src/RichTextEditor.tsx
@@ -57,6 +57,7 @@ import {
import type {BaseProps} from '@astryxdesign/core';
import {useInputStatusIcon} from '@astryxdesign/core/hooks';
import {VisuallyHidden} from '@astryxdesign/core/VisuallyHidden';
+import {useTranslator} from '@astryxdesign/core/i18n';
import {mergeProps, themeProps, type SizeValue} from '@astryxdesign/core/utils';
import {useSize} from '@astryxdesign/core/SizeContext';
@@ -246,13 +247,6 @@ const editorBodySizeStyles = stylex.create({
},
});
-/**
- * Default screen-reader hint advertising the Tab escape. Overridable (or
- * suppressible) via the `tabEscapeHint` prop for localization.
- */
-const DEFAULT_TAB_ESCAPE_HINT =
- 'Press Escape then Tab to move focus out of the editor.';
-
/**
* Fraction of `maxLength` at which the character counter begins announcing
* remaining/over-limit characters to screen readers. Matches TextArea.
@@ -453,9 +447,9 @@ export interface RichTextEditorProps extends Omit<
* Screen-reader hint describing how to move focus out of the editor, since
* Tab is bound to indentation (press Escape, then Tab). Rendered visually
* hidden and referenced from the editor's `aria-describedby`. Override it
- * to localize the text, or pass an empty string to omit the hint entirely
+ * to change the text, or pass an empty string to omit the hint entirely
* (e.g. when the host app provides its own instructions).
- * @default 'Press Escape then Tab to move focus out of the editor.'
+ * @default 'Press Escape then Tab to move focus out of the editor.', translated for the active locale
*/
tabEscapeHint?: string;
/**
@@ -526,7 +520,7 @@ export const RichTextEditor = forwardRef<
transformers = DEFAULT_TRANSFORMERS,
markdownExtensions,
hasAutoFocus = false,
- tabEscapeHint = DEFAULT_TAB_ESCAPE_HINT,
+ tabEscapeHint: tabEscapeHintFromProps,
maxLength,
namespace = 'astryx-editor',
xstyle,
@@ -537,6 +531,9 @@ export const RichTextEditor = forwardRef<
ref: Ref<RichTextEditorRef>,
) {
const size = useSize(sizeProp, 'md');
+ const t = useTranslator();
+ const tabEscapeHint =
+ tabEscapeHintFromProps ?? t('@astryx.richTextEditor.tabEscapeHint');
const inputID = useId();
const labelID = useId();
const descriptionID = useId();
@@ -764,8 +761,12 @@ export const RichTextEditor = forwardRef<
<VisuallyHidden aria-live="polite">
{charCount >= maxLength * COUNTER_WARNING_THRESHOLD
? charCount > maxLength
- ? `${charCount - maxLength} characters over limit`
- : `${maxLength - charCount} characters remaining`
+ ? t('@astryx.textArea.charactersOverLimit', {
+ count: charCount - maxLength,
+ })
+ : t('@astryx.textArea.charactersRemaining', {
+ count: maxLength - charCount,
+ })
: ''}
</VisuallyHidden>
</div>
diff --git a/packages/richtext/src/RichTextEditorToolbar.tsx b/packages/richtext/src/RichTextEditorToolbar.tsx
index e60ace48b3..f57a3a474b 100644
--- a/packages/richtext/src/RichTextEditorToolbar.tsx
+++ b/packages/richtext/src/RichTextEditorToolbar.tsx
@@ -75,6 +75,7 @@ import {
LayoutFooter,
} from '@astryxdesign/core/Layout';
import {getExtendedIcon} from '@astryxdesign/core/Icon';
+import {useTranslator} from '@astryxdesign/core/i18n';
import {
FORMAT_TEXT_COMMAND,
UNDO_COMMAND,
@@ -102,12 +103,6 @@ import {$selectedExtensionNodesOnly} from './markdownExtensionNode';
type BlockType =
'paragraph' | 'h1' | 'h2' | 'h3' | 'quote' | 'bullet' | 'number';
-const HEADING_LABELS: Record<'h1' | 'h2' | 'h3', string> = {
- h1: 'Heading 1',
- h2: 'Heading 2',
- h3: 'Heading 3',
-};
-
/**
* The platform-primary modifier for shortcuts: Cmd on Apple, Ctrl elsewhere.
* Mirrors the Lexical playground's `CONTROL_OR_META`
@@ -179,15 +174,11 @@ export const RICHTEXT_ICON_KEYS = {
} as const;
const INLINE_FORMAT_ACTIONS = [
- {format: 'bold', label: 'Bold', icon: 'bold'},
- {format: 'italic', label: 'Italic', icon: 'italic'},
- {format: 'underline', label: 'Underline', icon: 'underline'},
- {
- format: 'strikethrough',
- label: 'Strikethrough',
- icon: 'strikethrough',
- },
- {format: 'code', label: 'Inline code', icon: 'code'},
+ {format: 'bold', icon: 'bold'},
+ {format: 'italic', icon: 'italic'},
+ {format: 'underline', icon: 'underline'},
+ {format: 'strikethrough', icon: 'strikethrough'},
+ {format: 'code', icon: 'code'},
] as const;
type InlineFormat = (typeof INLINE_FORMAT_ACTIONS)[number]['format'];
@@ -411,7 +402,7 @@ function resolveIcon(name: keyof typeof RICHTEXT_ICON_KEYS): ReactNode {
export interface RichTextEditorToolbarProps {
/**
* Accessible label for the toolbar element.
- * @default 'Text formatting'
+ * @default 'Text formatting', translated for the active locale
*/
label?: string;
/**
@@ -482,7 +473,7 @@ export interface RichTextEditorToolbarProps {
* ```
*/
export function RichTextEditorToolbar({
- label = 'Text formatting',
+ label: labelFromProps,
headingLevels = ['h1', 'h2', 'h3'],
size = 'sm',
hasLink = true,
@@ -491,6 +482,21 @@ export function RichTextEditorToolbar({
endContent,
}: RichTextEditorToolbarProps) {
const [editor] = useLexicalComposerContext();
+ const t = useTranslator();
+ const label = labelFromProps ?? t('@astryx.richTextEditor.toolbar.label');
+ // Literal keys, so the catalog gate can verify every one.
+ const headingLabels = {
+ h1: t('@astryx.richTextEditor.toolbar.heading1'),
+ h2: t('@astryx.richTextEditor.toolbar.heading2'),
+ h3: t('@astryx.richTextEditor.toolbar.heading3'),
+ };
+ const inlineFormatLabels: Record<InlineFormat, string> = {
+ bold: t('@astryx.richTextEditor.toolbar.bold'),
+ italic: t('@astryx.richTextEditor.toolbar.italic'),
+ underline: t('@astryx.richTextEditor.toolbar.underline'),
+ strikethrough: t('@astryx.richTextEditor.toolbar.strikethrough'),
+ code: t('@astryx.richTextEditor.toolbar.inlineCode'),
+ };
const [activeFormats, setActiveFormats] = useState<Set<string>>(new Set());
const [blockType, setBlockType] = useState<BlockType>('paragraph');
const [isLink, setIsLink] = useState(false);
@@ -695,12 +701,12 @@ export function RichTextEditorToolbar({
(event: FormEvent<HTMLElement>) => {
event.preventDefault();
if (!applyLinkValue(linkUrl)) {
- setLinkError('Enter a valid http, https, mailto, or tel URL.');
+ setLinkError(t('@astryx.richTextEditor.link.invalidUrl'));
return;
}
closeLinkDialogToEditor();
},
- [applyLinkValue, closeLinkDialogToEditor, linkUrl],
+ [applyLinkValue, closeLinkDialogToEditor, linkUrl, t],
);
const removeLink = useCallback(() => {
@@ -808,25 +814,29 @@ export function RichTextEditorToolbar({
const blockOptions: SelectorOptionType[] = [
{
value: 'paragraph',
- label: 'Paragraph',
+ label: t('@astryx.richTextEditor.toolbar.paragraph'),
icon: resolveIcon('paragraph'),
},
...headingLevels.map(level => ({
value: level,
- label: HEADING_LABELS[level],
+ label: headingLabels[level],
icon: resolveIcon(level),
})),
{
value: 'bullet',
- label: 'Bulleted list',
+ label: t('@astryx.richTextEditor.toolbar.bulletedList'),
icon: resolveIcon('bullet'),
},
{
value: 'number',
- label: 'Numbered list',
+ label: t('@astryx.richTextEditor.toolbar.numberedList'),
icon: resolveIcon('number'),
},
- {value: 'quote', label: 'Block quote', icon: resolveIcon('quote')},
+ {
+ value: 'quote',
+ label: t('@astryx.richTextEditor.toolbar.blockQuote'),
+ icon: resolveIcon('quote'),
+ },
];
return (
@@ -838,31 +848,31 @@ export function RichTextEditorToolbar({
<HStack
gap={1}
role="group"
- aria-label="Formatting actions"
+ aria-label={t('@astryx.richTextEditor.toolbar.actions')}
xstyle={toolbarScrollStyles.actions}>
<IconButton
- label="Undo"
+ label={t('@astryx.richTextEditor.toolbar.undo')}
icon={resolveIcon('undo')}
variant="ghost"
- tooltip="Undo"
+ tooltip={t('@astryx.richTextEditor.toolbar.undo')}
isDisabled={!isEditable || !canUndo}
onClick={() => editor.dispatchCommand(UNDO_COMMAND, undefined)}
/>
<IconButton
- label="Redo"
+ label={t('@astryx.richTextEditor.toolbar.redo')}
icon={resolveIcon('redo')}
variant="ghost"
- tooltip="Redo"
+ tooltip={t('@astryx.richTextEditor.toolbar.redo')}
isDisabled={!isEditable || !canRedo}
onClick={() => editor.dispatchCommand(REDO_COMMAND, undefined)}
/>
<Divider
orientation="vertical"
- aria-label="History and block formats"
+ aria-label={t('@astryx.richTextEditor.toolbar.historyDivider')}
xstyle={toolbarDividerStyles.vertical}
/>
<Selector
- label="Block format"
+ label={t('@astryx.richTextEditor.toolbar.blockFormat')}
isLabelHidden
variant="ghost"
size={size}
@@ -874,13 +884,13 @@ export function RichTextEditorToolbar({
/>
<Divider
orientation="vertical"
- aria-label="Block and inline formats"
+ aria-label={t('@astryx.richTextEditor.toolbar.formatDivider')}
xstyle={toolbarDividerStyles.vertical}
/>
{INLINE_FORMAT_ACTIONS.map(action => (
<ToggleButton
key={action.format}
- label={action.label}
+ label={inlineFormatLabels[action.format]}
icon={resolveIcon(action.icon)}
size={size}
isIconOnly
@@ -892,7 +902,7 @@ export function RichTextEditorToolbar({
{hasLink && (
<ToggleButton
key="link"
- label="Link"
+ label={t('@astryx.richTextEditor.toolbar.link')}
icon={resolveIcon('link')}
size={size}
isIconOnly
@@ -924,14 +934,18 @@ export function RichTextEditorToolbar({
height="auto"
header={
<DialogHeader
- title={isEditingLink ? 'Edit link' : 'Insert link'}
+ title={
+ isEditingLink
+ ? t('@astryx.richTextEditor.link.editTitle')
+ : t('@astryx.richTextEditor.link.insertTitle')
+ }
onOpenChange={handleLinkDialogOpenChange}
/>
}
content={
<LayoutContent>
<TextInput
- label="URL"
+ label={t('@astryx.richTextEditor.link.url')}
value={linkUrl}
width="100%"
hasAutoFocus
@@ -953,18 +967,22 @@ export function RichTextEditorToolbar({
<HStack gap={2} hAlign="end">
{isEditingLink && (
<Button
- label="Remove link"
+ label={t('@astryx.richTextEditor.link.remove')}
variant="destructive"
onClick={removeLink}
/>
)}
<Button
- label="Cancel"
+ label={t('@astryx.richTextEditor.link.cancel')}
variant="secondary"
onClick={() => handleLinkDialogOpenChange(false)}
/>
<Button
- label={isEditingLink ? 'Update link' : 'Add link'}
+ label={
+ isEditingLink
+ ? t('@astryx.richTextEditor.link.update')
+ : t('@astryx.richTextEditor.link.add')
+ }
variant="primary"
type="submit"
/>
diff --git a/scripts/check-i18n-catalog.mjs b/scripts/check-i18n-catalog.mjs
index 5b526c3dd3..0ad65b71c9 100644
--- a/scripts/check-i18n-catalog.mjs
+++ b/scripts/check-i18n-catalog.mjs
@@ -8,7 +8,7 @@
* browser warning, not a gate, so a typo or a stale key ships. This asserts:
*
* 1. Source ⊆ catalog. Every `@astryx.*` key referenced in packages/core/src
- * and packages/lab/src exists in en.json.
+ * packages/lab/src, and packages/richtext/src exists in en.json.
* 2. Locale parity. Translated catalogs may omit keys and fall back to en,
* but extra keys are stale and fail.
* 3. Every en.json entry carries a non-empty `description` — the only
@@ -43,7 +43,11 @@ const require = createRequire(import.meta.url);
const ts = require('typescript');
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
-const SRC_DIRS = ['packages/core/src', 'packages/lab/src'];
+const SRC_DIRS = [
+ 'packages/core/src',
+ 'packages/lab/src',
+ 'packages/richtext/src',
+];
const LOCALES_DIR = 'packages/core/locales';
/**