Download packages/effects/layouts/src/widgets/language-toggle.vue from binhugg3/admin: direct link, hf CLI and curl.
- Browser
- Download file 951 Bytes
-
https://huggingface.co/spaces/binhugg3/admin/resolve/main/packages/effects/layouts/src/widgets/language-toggle.vue
- Command line
-
hf download hf://spaces/binhugg3/admin/packages/effects/layouts/src/widgets/language-toggle.vue
-
curl -L -o language-toggle.vue https://huggingface.co/spaces/binhugg3/admin/resolve/main/packages/effects/layouts/src/widgets/language-toggle.vue
951 Bytes
| <script setup lang="ts"> | |
| import type { SupportedLanguagesType } from '@vben/locales'; | |
| import { SUPPORT_LANGUAGES } from '@vben/constants'; | |
| import { Languages } from '@vben/icons'; | |
| import { loadLocaleMessages } from '@vben/locales'; | |
| import { preferences, updatePreferences } from '@vben/preferences'; | |
| import { VbenDropdownRadioMenu, VbenIconButton } from '@vben-core/shadcn-ui'; | |
| defineOptions({ | |
| name: 'LanguageToggle', | |
| }); | |
| async function handleUpdate(value: string) { | |
| const locale = value as SupportedLanguagesType; | |
| updatePreferences({ | |
| app: { | |
| locale, | |
| }, | |
| }); | |
| await loadLocaleMessages(locale); | |
| } | |
| </script> | |
| <template> | |
| <div> | |
| <VbenDropdownRadioMenu | |
| :menus="SUPPORT_LANGUAGES" | |
| :model-value="preferences.app.locale" | |
| @update:model-value="handleUpdate" | |
| > | |
| <VbenIconButton> | |
| <Languages class="text-foreground size-4" /> | |
| </VbenIconButton> | |
| </VbenDropdownRadioMenu> | |
| </div> | |
| </template> | |