perf(localization): Integrate Tolgee inside CI (#1276)

This commit is contained in:
Rémi Marseault 2023-11-07 09:31:44 +01:00 committed by GitHub
parent d4833a6691
commit 86e12da8d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 43 additions and 74 deletions

View file

@ -25,6 +25,11 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Update locales
run: |
curl -H 'X-API-KEY: ${{ secrets.TOLGEE_TOKEN }}' 'https://app.tolgee.io/v2/projects/export' -o locales.zip
unzip -o -d ./src/locales locales.zip
- name: Build VueTorrent
run: npm run build

View file

@ -13,7 +13,6 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run release please
uses: google-github-actions/release-please-action@v3
id: release
@ -31,8 +30,6 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ needs.setup-release.outputs.release_ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
@ -49,6 +46,11 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Update locales
run: |
curl -H 'X-API-KEY: ${{ secrets.TOLGEE_TOKEN }}' 'https://app.tolgee.io/v2/projects/export' -o locales.zip
unzip -o -d ./src/locales locales.zip
- name: Build VueTorrent
run: npm run build
@ -90,6 +92,11 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Update locales
run: |
curl -H 'X-API-KEY: ${{ secrets.TOLGEE_TOKEN }}' 'https://app.tolgee.io/v2/projects/export' -o locales.zip
unzip -o -d ./src/locales locales.zip
- name: Build VueTorrent
run: npm run build

View file

@ -93,7 +93,7 @@ If you like to always have the latest and greatest, please sync to the `nightly-
- Extra features the default WebUI doesn't have
- mobile friendly! (can be installed as a PWA)
- Configureable Dashboard: choose which torrent properties are shown for both busy and completed torrents
- works with qBittorrent v4.4 and later
- Optimized for the latest version of qBittorrent
## Contributing
@ -103,17 +103,7 @@ I'll gladly accept help/pull requests & advice!
### Localize the app
To help us localize VueTorrent, you will need to:
- `src/locales/<your language>.json`
- Create a json file containing the translations by matching the structure of `en.json`
- every key may not be specified, that's fine, it will default to the english locale
- `<your language>` should match the ISO 639 locale code of the added language
- `src/locales/locales.ts`
- add your language to the `Locales` enum, it should match the json filename
- Update the `LOCALES` constant with the local language name and the created enum value
- `src/locales/index.ts`
- import the json file
- include it in the `messages` object using the created enum value as key
We use [Tolgee](https://tolgee.io/) to manage translations. You can help translate the app by visiting [this link](https://app.tolgee.io/accept_invitation/sqSGXMwEkKapcAbNotICHxkxhIoPTuQKsrqpXHLxeXDxpTSBSo).
## Support

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "vuetorrent",
"version": "2.0.1",
"version": "2.1.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "vuetorrent",
"version": "2.0.1",
"version": "2.1.0",
"dependencies": {
"@fontsource/roboto": "^5.0.8",
"@fontsource/roboto-mono": "^5.0.14",

View file

@ -1,6 +1,6 @@
<script setup lang="ts">
import { TitleOptions } from '@/constants/vuetorrent'
import { LOCALES } from '@/locales/locales'
import { LOCALES } from '@/locales'
import { useAppStore } from '@/stores/app'
import { useVueTorrentStore } from '@/stores/vuetorrent'
import { computed, onBeforeMount, ref } from 'vue'

View file

@ -1,31 +1,34 @@
import { Locales } from './locales'
import en from './en.json'
import es from './es.json'
import fr from './fr.json'
// import id from './id.json'
// import it from './it.json'
// import ja from './ja.json'
// import nl from './nl.json'
// import pt_br from './pt-br.json'
// import ru from './ru.json'
// import uk from './uk.json'
// import vi from './vi.json'
import zh_hans from './zh-hans.json'
import zh_hant from './zh-hant.json'
import zh_hans from './zh-Hans.json'
import zh_hant from './zh-Hant.json'
type LocaleDef = {
title: string
value: Locales
}
export enum Locales {
EN = 'en',
ES = 'es',
FR = 'fr',
ZH_HANS = 'zh-Hans',
ZH_HANT = 'zh-Hant'
}
export const LOCALES: LocaleDef[] = [
{ title: 'English', value: Locales.EN },
{ title: 'Español', value: Locales.ES },
{ title: 'Français', value: Locales.FR },
{ title: '简体中文', value: Locales.ZH_HANS },
{ title: '繁體中文', value: Locales.ZH_HANT }
]
export const messages: Record<Locales, any> = {
[Locales.EN]: en,
[Locales.ES]: es,
[Locales.FR]: fr,
// [Locales.ID]: id,
// [Locales.IT]: it,
// [Locales.JA]: ja,
// [Locales.NL]: nl,
// [Locales.PT_BR]: pt_br,
// [Locales.RU]: ru,
// [Locales.UK]: uk,
// [Locales.VI]: vi,
[Locales.ZH_HANS]: zh_hans,
[Locales.ZH_HANT]: zh_hant
}

View file

@ -1,36 +0,0 @@
export enum Locales {
EN = 'en',
ES = 'es',
FR = 'fr',
// ID = 'id',
// IT = 'it',
// JA = 'ja',
// NL = 'nl',
// PT_BR = 'pt-br',
// RU = 'ru',
// UK = 'ua',
// VI = 'vi',
ZH_HANS = 'zh-hans',
ZH_HANT = 'zh-hant'
}
type LocaleDef = {
title: string
value: Locales
}
export const LOCALES: LocaleDef[] = [
{ title: 'English', value: Locales.EN },
{ title: 'Español', value: Locales.ES },
{ title: 'Français', value: Locales.FR },
// { title: 'Bahasa Indonesia', value: Locales.ID },
// { title: 'Italiano', value: Locales.IT },
// { title: '日本語', value: Locales.JA },
// { title: 'Dutch', value: Locales.NL },
// { title: 'Português', value: Locales.PT_BR },
// { title: 'Русский язык', value: Locales.RU },
// { title: 'Українська', value: Locales.UK },
// { title: 'Tiếng Việt', value: Locales.VI },
{ title: '简体中文', value: Locales.ZH_HANS },
{ title: '繁體中文', value: Locales.ZH_HANT }
]