Skip to content

Commit

Permalink
docs: translate code copy feature
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdvlpr committed Dec 17, 2024
1 parent c97c1f6 commit ac9efc7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"arrowDown": "down arrow",
"arrowUp": "up arrow",
"backButtonTitle": "Back",
"codeCopyButtonTitle": "Copy Code",
"copied": "Copied",
"closeText": "to close",
"darkModeSwitchLabel": "Appearance",
"darkModeSwitchTitle": "Switch to dark theme",
Expand Down
2 changes: 2 additions & 0 deletions docs/locales/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"arrowDown": "pijltje omlaag",
"arrowUp": "pijltje omhoog",
"backButtonTitle": "Terug",
"codeCopyButtonTitle": "Code kopiëren",
"copied": "Gekopieerd",
"closeText": "om te sluiten",
"darkModeSwitchLabel": "Weergave",
"darkModeSwitchTitle": "Schakel donker thema in",
Expand Down
12 changes: 12 additions & 0 deletions docs/utils/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ const mapLocale = (
property: 'og:locale:alternate',
},
]),
[
'style',
{},
`:lang(${lang}) {--vp-code-copy-copied-text-content: '${msg.copied}'}`,
],
[
'script',
{},
`window.addEventListener('load', () => {
document.querySelectorAll('button.copy').forEach((b) => {b.title = '${msg.codeCopyButtonTitle}';})
})`,
],
],
label,
lang,
Expand Down

0 comments on commit ac9efc7

Please sign in to comment.