Skip to content

Commit

Permalink
fix(theme-press): i18n of menu in mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
YunYouJun committed Oct 4, 2023
1 parent d18e70d commit ebc881d
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 15 deletions.
1 change: 1 addition & 0 deletions packages/valaxy-theme-press/components/PressAside.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const app = useAppStore()
p="l-0 xl:l-8" text="center"
z="$"
:class="app.isRightSidebarOpen && 'open'"
bg="$va-c-bg"
>
<div class="aside-curtain" />
<div class="aside-container lt-xl:fixed" flex="~ col">
Expand Down
10 changes: 8 additions & 2 deletions packages/valaxy-theme-press/components/PressLocalNav.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script lang="ts" setup>
import { useSidebar } from 'valaxy'
import { useI18n } from 'vue-i18n'
defineProps<{
open: boolean
}>()
Expand All @@ -14,6 +16,8 @@ const { hasSidebar } = useSidebar()
function scrollToTop() {
window.scrollTo({ top: 0, left: 0, behavior: 'smooth' })
}
const { t } = useI18n()
</script>

<template>
Expand All @@ -25,11 +29,13 @@ function scrollToTop() {
@click="$emit('openMenu')"
>
<div i-ri-align-left class="menu-icon" />
<span class="menu-text">Menu</span>
<span class="menu-text">
{{ t('menu.title') }}
</span>
</button>

<a class="top-link" href="#" @click="scrollToTop">
Return to top
{{ t('sidebar.return_top') }}
</a>
</div>
</template>
Expand Down
5 changes: 4 additions & 1 deletion packages/valaxy-theme-press/components/PressNavItemLink.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<script lang="ts" setup>
import { useRoute } from 'vue-router'
import { useI18n } from 'vue-i18n'
import type { NavItemLink } from '../types'
defineProps<{
item: NavItemLink
}>()
const route = useRoute()
const { t } = useI18n()
</script>

<template>
Expand All @@ -19,7 +22,7 @@ const route = useRoute()
rel="noopener"
show-external-icon
>
{{ item.text }}
{{ t(item.text) }}
</AppLink>
</template>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<script lang="ts" setup>
import { useThemeConfig } from '../composables/config'
import { useI18n } from 'vue-i18n'
const themeConfig = useThemeConfig()
const { t } = useI18n()
</script>

<template>
<div class="pr-nav-screen-appearance" flex="~ 1">
<p class="text">
{{ themeConfig.darkModeSwitchLabel || 'Appearance' }}
{{ t('button.appearance') }}
</p>
<PressSwitchAppearance />
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script lang="ts" setup>
import { computed, ref } from 'vue'
import { useI18n } from 'vue-i18n'
const props = defineProps<{
text: string
items: any[]
Expand All @@ -12,6 +14,8 @@ const groupId = computed(() =>
`NavScreenGroup-${props.text.replace(' ', '-').toLowerCase()}`,
)
const { t } = useI18n()
function toggle() {
isOpen.value = !isOpen.value
}
Expand All @@ -25,7 +29,7 @@ function toggle() {
:aria-expanded="isOpen"
@click="toggle"
>
<span class="button-text">{{ text }}</span>
<span class="button-text">{{ t(text) }}</span>
<div i-ri-add-line class="button-icon" />
</button>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
<script lang="ts" setup>
import { inject } from 'vue'
import { useI18n } from 'vue-i18n'
defineProps<{
text: string
link: string
}>()
const closeScreen = inject('close-screen') as () => void
const { t } = useI18n()
</script>

<template>
<AppLink class="pr-nav-screen-menu-group-link" :to="link" @click="closeScreen">
{{ text }}
{{ t(text) }}
</AppLink>
</template>

Expand Down
6 changes: 0 additions & 6 deletions packages/valaxy-theme-press/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,6 @@ export namespace PressTheme {

socialLinks: SocialLink[]

// label
/**
* Toggle dark label
*/
darkModeSwitchLabel?: string

lastUpdatedText?: string
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/valaxy-theme-yun/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "valaxy-theme-yun",
"version": "0.15.3",
"version": "0.15.3-alpha.0",
"author": {
"email": "[email protected]",
"name": "YunYouJun",
Expand Down
3 changes: 3 additions & 0 deletions packages/valaxy/client/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ button:
toggle_light: Switch to light mode
toggle_dark: Switch to dark mode
toggle_langs: Change languages
appearance: Appearance
intro:
desc: Theme Yun | Valaxy
hi: Hi, {name}!
Expand All @@ -19,6 +20,7 @@ title:
gallery: Gallery

menu:
title: Menu
home: Home
archives: Archives
categories: Categories
Expand All @@ -29,6 +31,7 @@ menu:
sidebar:
overview: Overview
toc: Table of Contents
return_top: Return to top

post:
decrypt: DECRYPT
Expand Down
3 changes: 3 additions & 0 deletions packages/valaxy/client/locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ button:
toggle_light: 切换亮色模式
toggle_dark: 切换深色模式
toggle_langs: 切换语言
appearance: 外观
intro:
desc: 主题 Yun
hi: 你好,{name}
Expand All @@ -19,6 +20,7 @@ title:
gallery: 图片库

menu:
title: 菜单
home: 首页
archives: 归档
categories: 分类
Expand All @@ -29,6 +31,7 @@ menu:
sidebar:
overview: 站点概览
toc: 文章目录
return_top: 返回顶部

post:
decrypt: 解密
Expand Down

2 comments on commit ebc881d

@vercel
Copy link

@vercel vercel bot commented on ebc881d Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://yun.valaxy.site as production
🚀 Deployed on https://651de598a5146372d58b7c67--valaxy.netlify.app

Please sign in to comment.