Localizing the AI plugin
The AI plugin’s UI uses US English. Its strings live in Puck’s dictionary prop, so you can translate or reword them alongside the rest of the editor.
See the Dictionary API reference for the full list of strings and their defaults.
Translating plugin strings
To translate strings, provide a dictionary object with the keys you want to change and their corresponding translations. The AI plugin’s keys start with plugin-ai-.
import { Puck } from "@puckeditor/core";
import { createAiPlugin } from "@puckeditor/plugin-ai";
const aiPlugin = createAiPlugin();
export function Editor() {
return (
<Puck
plugins={[aiPlugin]}
dictionary={{
"header-publish": "Publicar", // Puck's "Publish" button
"plugin-ai-prompt-placeholder": "¿Qué quieres construir?", // Prompt input
"plugin-ai-chat-msg-thinking": "Pensando...", // Waiting for a response
}}
config={config}
data={data}
/>
);
}See Puck’s localization guide for the rest of the editor’s strings, switching languages at runtime, and interpolating values.
Translating the plugin label
The plugin’s label in the plugin rail is set with the label param. Translate it before passing the plugin to Puck.
const aiPlugin = createAiPlugin({ label: "IA" });