Skip to content

How to add new translation when adding custom component? #3309

Answered by linonetwo
linonetwo asked this question in Q&A
Discussion options

You must be logged in to vote

There is clue that https://github.com/tldraw/tldraw/blob/adebb680e5ebe913b3e8a40e3a796d57b9ffd799/packages/tldraw/src/lib/ui/overrides.ts can allow passing custom text for tools, but no evident telling where to add this overrides.


It is just the ui-overrides in the doc.

So this works

export const overrides: TLUiOverrides = {
  tools(editor, tools) {
    tools.transclude = {
      id: TranscludeTool.id,
      label: 'tool.transclude',
      readonlyOk: false,
      icon: 'transcludify',
      kbd: 't',
      onSelect(_source) {
        editor.setCurrentTool(TranscludeTool.id);
      },
    };
    return tools;
  },
  toolbar(_app, toolbar, { tools }) {
    toolbar.splice(4, 0, toolbarItem…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@linonetwo
Comment options

Answer selected by linonetwo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant