Localizing the AI plugin
The AI plugin’s UI uses US English. You can localize it via Puck’s dictionary prop, extended with additional tokens.
Translating plugin strings
To translate strings, provide a dictionary object with the keys you want to change and their corresponding localizations. 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 a full explanation of localizing, including interpolating values and switching languages at runtime.
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" });