diff --git a/docs/components/pages/landing/hero/DemoEditor.tsx b/docs/components/pages/landing/hero/DemoEditor.tsx index 192d4bbf4e..9919e2ce19 100644 --- a/docs/components/pages/landing/hero/DemoEditor.tsx +++ b/docs/components/pages/landing/hero/DemoEditor.tsx @@ -2,9 +2,9 @@ import { BlockNoteSchema, combineByGroup, filterSuggestionItems, - locales, uploadToTmpFilesDotOrg_DEV_ONLY, } from "@blocknote/core"; +import * as locales from "@blocknote/core/locales"; import "@blocknote/core/fonts/inter.css"; import { getDefaultReactSlashMenuItems, diff --git a/examples/01-basic/03-multi-column/App.tsx b/examples/01-basic/03-multi-column/App.tsx index 630f8e557a..b10d9808b5 100644 --- a/examples/01-basic/03-multi-column/App.tsx +++ b/examples/01-basic/03-multi-column/App.tsx @@ -2,8 +2,8 @@ import { BlockNoteSchema, combineByGroup, filterSuggestionItems, - locales, } from "@blocknote/core"; +import * as locales from "@blocknote/core/locales"; import "@blocknote/core/fonts/inter.css"; import { BlockNoteView } from "@blocknote/mantine"; import "@blocknote/mantine/style.css"; diff --git a/examples/01-basic/10-localization/App.tsx b/examples/01-basic/10-localization/App.tsx index 72b7557f1f..7000c3e436 100644 --- a/examples/01-basic/10-localization/App.tsx +++ b/examples/01-basic/10-localization/App.tsx @@ -1,4 +1,4 @@ -import { locales } from "@blocknote/core"; +import { nl } from "@blocknote/core/locales"; import "@blocknote/core/fonts/inter.css"; import { BlockNoteView } from "@blocknote/mantine"; import "@blocknote/mantine/style.css"; @@ -12,7 +12,7 @@ export default function App() { // Passes the Dutch (NL) dictionary to the editor instance. // You can also provide your own dictionary here to customize the strings used in the editor, // or submit a Pull Request to add support for your language of your choice - dictionary: locales.nl, + dictionary: nl, // dictionary: locales[lang as keyof typeof locales], // Use the language from the i18n library dynamically }); diff --git a/examples/01-basic/11-custom-placeholder/App.tsx b/examples/01-basic/11-custom-placeholder/App.tsx index 2919ce8e0d..b1323aacb5 100644 --- a/examples/01-basic/11-custom-placeholder/App.tsx +++ b/examples/01-basic/11-custom-placeholder/App.tsx @@ -1,4 +1,4 @@ -import { locales } from "@blocknote/core"; +import { en } from "@blocknote/core/locales"; import "@blocknote/core/fonts/inter.css"; import { BlockNoteView } from "@blocknote/mantine"; import "@blocknote/mantine/style.css"; @@ -6,7 +6,7 @@ import { useCreateBlockNote } from "@blocknote/react"; export default function App() { // We use the English, default dictionary - const locale = locales["en"]; + const locale = en; // Creates a new editor instance. const editor = useCreateBlockNote({ diff --git a/packages/core/package.json b/packages/core/package.json index 3510bbdc0c..ff7e9f7f39 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -49,6 +49,11 @@ "types": "./types/src/comments/index.d.ts", "import": "./dist/comments.js", "require": "./dist/comments.cjs" + }, + "./locales": { + "types": "./types/src/i18n/index.d.ts", + "import": "./dist/locales.js", + "require": "./dist/locales.cjs" } }, "scripts": { diff --git a/packages/core/src/i18n/index.ts b/packages/core/src/i18n/index.ts new file mode 100644 index 0000000000..73f53b8826 --- /dev/null +++ b/packages/core/src/i18n/index.ts @@ -0,0 +1,2 @@ +export * from "./locales/index.js"; +export * from "./dictionary.js"; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 3ec64b0dc6..2c70a913aa 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,4 +1,3 @@ -import * as locales from "./i18n/locales/index.js"; export * from "./api/blockManipulation/commands/updateBlock/updateBlock.js"; export * from "./api/exporters/html/externalHTMLExporter.js"; export * from "./api/exporters/html/internalHTMLSerializer.js"; @@ -57,7 +56,6 @@ export * from "./util/table.js"; export * from "./util/string.js"; export * from "./util/typescript.js"; export { UnreachableCaseError, assertEmpty } from "./util/typescript.js"; -export { locales }; // for testing from react (TODO: move): export * from "./api/nodeConversions/blockToNode.js"; @@ -69,4 +67,3 @@ export * from "./extensions/UniqueID/UniqueID.js"; export * from "./api/exporters/markdown/markdownExporter.js"; export * from "./api/parsers/html/parseHTML.js"; export * from "./api/parsers/markdown/parseMarkdown.js"; - diff --git a/packages/core/vite.config.ts b/packages/core/vite.config.ts index c5f9b60463..0fc59bfd4d 100644 --- a/packages/core/vite.config.ts +++ b/packages/core/vite.config.ts @@ -19,6 +19,7 @@ export default defineConfig({ entry: { blocknote: path.resolve(__dirname, "src/index.ts"), comments: path.resolve(__dirname, "src/comments/index.ts"), + locales: path.resolve(__dirname, "src/i18n/index.ts"), }, name: "blocknote", formats: ["es", "cjs"],