From 722369df15cb79df96b899f5cc0e9f66347228e5 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 28 Aug 2021 05:27:13 +0530 Subject: [PATCH] Fix translation and allow for widely disparate size requirements --- src/App.vue | 52 +++++++++++-------- .../{bn-latn.json => bn_latn.json} | 0 src/translations/en.json | 3 +- 3 files changed, 33 insertions(+), 22 deletions(-) rename src/translations/{bn-latn.json => bn_latn.json} (100%) diff --git a/src/App.vue b/src/App.vue index 9e6146c..780eb53 100644 --- a/src/App.vue +++ b/src/App.vue @@ -8,26 +8,25 @@ - + - {{ link.name }} + {{ $t(link.name) }} - + @@ -53,41 +52,52 @@ export default { components: { SearchMenu }, - metaInfo: { - title: 'Homepage', - // all titles will be injected into this template - titleTemplate: '%s - Piped' + metaInfo () { + return { + title: this.$t('titles.homepage'), + // all titles will be injected into this template + titleTemplate: '%s - Piped' + } }, data: () => ({ links: [ { id: 'prefs', - name: 'Preferences', + name: 'titles.preferences', to: '/preferences' }, { id: 'trending', - name: 'Trending', + name: 'titles.trending', to: '/' }, { id: 'watch-history', - name: 'Watch History', + name: 'titles.history', to: '/watch-history' } ], languageOptions: [ - { - text: 'English', - value: 'en' - } - ] + { value: 'zh_Hant', text: 'Chinese (Traditional)' }, + { value: 'en', text: 'English' }, + { value: 'fr', text: 'French' }, + { value: 'de', text: 'German' }, + { value: 'el', text: 'Greek' }, + { value: 'lt', text: 'Lithuanian' }, + { value: 'ml', text: 'Malayalam' }, + { value: 'nb_NO', text: 'Norwegian Bokmål' }, + { value: 'tr', text: 'Turkish' }, + { value: 'bn_latn', text: 'Bengali (Latin)' }, + { value: 'bn_beng', text: 'Bengali (বাংলা)' } + ].sort((a, b) => { + return a.text.localeCompare(b.text) + }) }), methods: { changeLocale (lang) { - return changeLocale(lang.value) + return changeLocale(lang) } }, created () { diff --git a/src/translations/bn-latn.json b/src/translations/bn_latn.json similarity index 100% rename from src/translations/bn-latn.json rename to src/translations/bn_latn.json diff --git a/src/translations/en.json b/src/translations/en.json index a58e63d..12cdf57 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1,11 +1,12 @@ { "titles": { + "homepage": "Homepage", "trending": "Trending", "login": "Login", "register": "Register", "feed": "Feed", "preferences": "Preferences", - "history": "History" + "history": "Watch History" }, "actions": { "subscribe": "Subscribe",