@@ -21,10 +21,12 @@ function downloadCurrentGuide() {
2121 downloadZip (play .webcontainer , guide .ignoredFiles )
2222}
2323
24+ const i18n = useI18n ()
25+
2426addCommands (
2527 {
2628 id: ' download-zip' ,
27- title: ' Download playground as ZIP ' ,
29+ title : () => $t ( ' download-zip ' ) ,
2830 visible : () => {
2931 return play .status === ' ready' && guide .features .download !== false
3032 },
@@ -35,12 +37,34 @@ addCommands(
3537 },
3638 {
3739 id: ' toggle-terminal' ,
38- title: ' Toggle terminal' ,
40+ title : () => $t ( ' terminal.toggle ' ) ,
3941 handler : () => {
4042 ui .toggleTerminal ()
4143 },
4244 icon: ' i-ph-terminal-window-duotone' ,
4345 },
46+ {
47+ id: ' language-en' ,
48+ title: ' Change to English' ,
49+ handler : () => {
50+ i18n .setLocale (' en' )
51+ },
52+ icon: ' i-ph-globe-duotone' ,
53+ visible : () => {
54+ return i18n .locale .value !== ' en'
55+ },
56+ },
57+ {
58+ id: ' language-ja' ,
59+ title: ' 日本語に切り替える' ,
60+ handler : () => {
61+ i18n .setLocale (' ja' )
62+ },
63+ icon: ' i-ph-globe-duotone' ,
64+ visible : () => {
65+ return i18n .locale .value !== ' ja'
66+ },
67+ },
4468)
4569 </script >
4670
@@ -56,7 +80,7 @@ addCommands(
5680 target =" _blank"
5781 >
5882 <div block translate-y--2 rounded bg-orange:10 px2 py1 text-xs text-orange >
59- Work in Progress
83+ {{ $t('work-in-progress') }}
6084 </div >
6185 </NuxtLink >
6286
@@ -65,10 +89,32 @@ addCommands(
6589 flex =" ~ gap-1 items-center"
6690 :class =" guide.embeddedDocs ? 'z-embedded-docs-raised' : ''"
6791 >
92+ <VDropdown :distance =" 6" >
93+ <button
94+ rounded p2
95+ hover =" bg-active"
96+ title =" Languages"
97+ >
98+ <div i-ph-translate-duotone text-2xl />
99+ </button >
100+ <template #popper >
101+ <div flex =" ~ col gap-y-1" p2 >
102+ <button
103+ v-for =" locale of i18n.locales.value" :key =" locale.code"
104+ rounded px2 py1
105+ hover =" bg-active"
106+ :class =" locale.code === i18n.locale.value ? 'text-primary' : ''"
107+ @click =" i18n.setLocale(locale.code)"
108+ >
109+ {{ locale.name }}
110+ </button >
111+ </div >
112+ </template >
113+ </VDropdown >
68114 <button
69115 rounded p2
70116 hover =" bg-active"
71- title =" Search "
117+ : title =" $t('search') "
72118 @click =" commands.isShown = true"
73119 >
74120 <div i-ph-magnifying-glass-duotone text-2xl />
@@ -77,7 +123,7 @@ addCommands(
77123 v-if =" play.status === 'ready' && !!guide.features.download"
78124 rounded p2
79125 hover =" bg-active"
80- title =" Download as ZIP "
126+ : title =" $t('download-zip') "
81127 @click =" downloadCurrentGuide()"
82128 >
83129 <div i-ph-download-duotone text-2xl />
@@ -103,7 +149,7 @@ addCommands(
103149 </VDropdown >
104150 <button
105151 rounded p2
106- title =" Toggle terminal"
152+ : title =" $t(' terminal.toggle') "
107153 hover =" bg-active"
108154 :class =" ui.showTerminal ? '' : 'op50'"
109155 @click =" ui.toggleTerminal()"
0 commit comments