Skip to content

Commit

Permalink
feat: add ching chong translation in vault
Browse files Browse the repository at this point in the history
  • Loading branch information
duchunter committed May 16, 2024
1 parent f84fda0 commit 914e8ee
Show file tree
Hide file tree
Showing 16 changed files with 1,986 additions and 57 deletions.
45 changes: 25 additions & 20 deletions src/renderer/components/landing/Footer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,30 +131,19 @@
<div class="w-full">
<!-- Language switcher -->
<div
:class="locale === 'vi' ? 'opacity-06' : ''"
:style="{ paddingLeft: locale === 'vi' ? '22px' : '0px' }"
v-for="item in languages"
:key="item.id"
:class="locale !== item.id ? 'opacity-06' : ''"
:style="{ paddingLeft: locale !== item.id ? '22px' : '0px' }"
class="text-sm text-black-600 font-normal hover:text-green"
style="cursor: pointer"
@click="setLocale('en')"
@click="setLocale(item.id)"
>
<span
v-show="locale !== 'vi'"
v-show="locale === item.id"
class="mr-2"
><i class="fas fa-location-arrow" /></span>English
><i class="fas fa-location-arrow" /></span>{{ item.name }}
</div>
<div
:class="locale === 'en' ? 'opacity-06' : ''"
:style="{ paddingLeft: locale !== 'vi' ? '22px' : '0px' }"
class="text-sm text-black-600 font-normal hover:text-green"
style="margin-top: 11px; cursor: pointer"
@click="setLocale('vi')"
>
<span
v-show="locale === 'vi'"
class="mr-2"
><i class="fas fa-location-arrow" /></span>Vietnamese
</div>

<!-- Language switcher end -->
</div>
</div>
Expand Down Expand Up @@ -209,6 +198,22 @@ export default {
computed: {
currentYear () {
return new Date().getFullYear()
},
languages () {
return [
{
id: 'en',
name: 'English'
},
{
id: 'vi',
name: 'Tiếng Việt'
}
// {
// id: 'zh',
// name: '繁體中文'
// }
]
}
},
mounted () {
Expand All @@ -218,15 +223,15 @@ export default {
setLocale (locale) {
this.changeLang(locale)
setTimeout(() => {
if (this.$route.path.startsWith('/vi/blog') && locale === 'en') {
if (this.$route.path.startsWith('/vi/blog') && locale !== 'vi') {
this.$router.push('/blog')
return
}
if (this.$route.path.startsWith('/blog') && locale === 'vi') {
this.$router.push('/vi/blog')
return
}
if (this.$route.path.startsWith('/vi/whitepaper') && locale === 'en') {
if (this.$route.path.startsWith('/vi/whitepaper') && locale !== 'vi') {
window.location.replace('/whitepaper')
return
}
Expand Down
6 changes: 2 additions & 4 deletions src/renderer/components/landing/whitepaper/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,11 @@ export default {
setLocale (locale) {
this.changeLang(locale)
setTimeout(() => {
if (locale === 'en') {
window.location.replace('/whitepaper')
return
}
if (locale === 'vi') {
window.location.replace('/vi/whitepaper')
return
}
window.location.replace('/whitepaper')
}, 200)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/notifications/NotificationBell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<div v-if="locale === 'vi'" class="font-semibold">
{{ item.title.vi }}
</div>
<div v-if="locale === 'en'" class="font-semibold">
<div v-else class="font-semibold">
{{ item.title.en }}
</div>
<el-button
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/components/setting/Preferences.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
placeholder="Select"
@change="changeLang"
>
<el-option :label="$t('data.settings.vietnamese')" value="vi" />
<el-option :label="$t('data.settings.english')" value="en" />
<el-option label="Tiếng Việt" value="vi" />
<el-option label="English" value="en" />
<el-option label="繁體中文" value="zh" />
<el-option :label="$t('data.settings.dont_find_lang')" value="new" />
</el-select>
</div>
Expand Down
12 changes: 11 additions & 1 deletion src/renderer/layouts/landing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ export default {
},
head () {
// this.$i18n.locale = this.lang
const locale = (() => {
switch (this.locale) {
case 'vi':
return 'vi_VN'
case 'zh':
return 'zh_TW'
default:
return 'en_US'
}
})()
return {
htmlAttrs: {
lang: this.locale
Expand All @@ -87,7 +97,7 @@ export default {
{
hid: 'og:locale',
property: 'og:locale',
content: this.locale === 'vi' ? 'vi_VN' : 'en_US'
content: locale
},
{
hid: 'twitter:title',
Expand Down
12 changes: 11 additions & 1 deletion src/renderer/layouts/register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ export default {
},
head () {
// this.$i18n.locale = this.lang
const locale = (() => {
switch (this.locale) {
case 'vi':
return 'vi_VN'
case 'zh':
return 'zh_TW'
default:
return 'en_US'
}
})()
return {
htmlAttrs: {
lang: this.locale
Expand All @@ -42,7 +52,7 @@ export default {
{
hid: 'og:locale',
property: 'og:locale',
content: this.locale === 'vi' ? 'vi_VN' : 'en_US'
content: locale
},
{
hid: 'twitter:title',
Expand Down
41 changes: 26 additions & 15 deletions src/renderer/layouts/whitepaper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,19 @@
<div class="hidden md:block sticky bottom-0 px-5 py-3 mr-[1px] border-t-[1px] border-r-[1px] border-solid border-[#C5C5C8]">
<!-- Language switcher -->
<div
:class="locale==='vi'?'opacity-06':''"
:style="{paddingLeft: locale==='vi'?'34px': '12px'}"
v-for="item in languages"
:key="item.id"
:class="locale !== item.id ? 'opacity-06' : ''"
:style="{ paddingLeft: locale !== item.id ? '22px' : '0px' }"
class="text-sm text-black-600 font-normal hover:text-green"
style="cursor: pointer;"
@click="setLocale('en')"
style="cursor: pointer"
@click="setLocale(item.id)"
>
<span v-show="locale!=='vi'" class="mr-2"><i class="fas fa-location-arrow" /></span>English
<span
v-show="locale === item.id"
class="mr-2"
><i class="fas fa-location-arrow" /></span>{{ item.name }}
</div>
<div
:class="locale==='en'?'opacity-06':''"
:style="{paddingLeft: locale!=='vi'?'34px': '12px'}"
class="text-sm text-black-600 font-normal hover:text-green"
style="margin-top: 11px; cursor: pointer;"
@click="setLocale('vi')"
>
<span v-show="locale==='vi'" class="mr-2"><i class="fas fa-location-arrow" /></span>Vietnamese
</div>

<!-- Language switcher end -->
</div>
</div>
Expand Down Expand Up @@ -235,6 +230,22 @@ export default {
computed: {
language () {
return this.$store.state.user.language
},
languages () {
return [
{
id: 'en',
name: 'English'
},
{
id: 'vi',
name: 'Tiếng Việt'
}
// {
// id: 'zh',
// name: '繁體中文'
// }
]
}
},
watch: {
Expand Down
Loading

0 comments on commit 914e8ee

Please sign in to comment.