Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n with markdown containers #3861

Open
brc-dd opened this issue May 3, 2024 · 1 comment
Open

i18n with markdown containers #3861

brc-dd opened this issue May 3, 2024 · 1 comment
Labels
build Related to the build system enhancement New feature or request

Comments

@brc-dd
Copy link
Member

brc-dd commented May 3, 2024

similar to vuepress

@brc-dd brc-dd added enhancement New feature or request build Related to the build system labels May 3, 2024
@github-actions github-actions bot added the stale label Jun 9, 2024
@its-miroma
Copy link

Currently, Markdown Containers' titles can be changed in a markdown option in the configuration (source), however that does not allow localisation.

Reproduction

https://stackblitz.com/edit/vite-cece3h?file=docs%2F.vitepress%2Fconfig.ts

.vitepress/config.ts
import { defineConfig } from 'vitepress';

export default defineConfig({
  locales: {
    root: {
      label: 'English',
      lang: 'en',
      link: '/',
      title: 'VitePress - English',
    },
    fr: {
      label: 'Français',
      lang: 'fr',
      link: '/fr/',
      title: 'VitePress - Français',
    },
  },

  markdown: {
    container: {
      tipLabel: 'CUSTOM TIP',
    },
  },
});
index.md
---
layout: home

hero:
  name: VitePress - English
---

::: tip
^^^ Not translatable ^^^
:::

::: tip CUSTOM TIP: Title
^^^ Workaround ^^^
:::
fr/index.md
---
layout: home

hero:
  name: VitePress - Français
---

::: tip
^^^ Intraduisible ^^^
:::

::: tip CONSEIL PERSONNALISÉ: Titre
^^^ Solution de contournement ^^^
:::

Expected behavior

.vitepress/config.ts
import { defineConfig } from 'vitepress';

export default defineConfig({
  locales: {
    root: {
      label: 'English',
      lang: 'en',
      link: '/',
      themeConfig: {
        markdown: {
          container: {
            tipLabel: 'CUSTOM TIP',
          },
        },
      },
      title: 'VitePress - English',
    },
    fr: {
      label: 'Français',
      lang: 'fr',
      link: '/fr/',
      themeConfig: {
        markdown: {
          container: {
            tipLabel: 'CONSEIL PERSONNALISÉ',
          },
        },
      },
      title: 'VitePress - Français',
    },
  },
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Related to the build system enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants