Skip to content

Commit

Permalink
Support French
Browse files Browse the repository at this point in the history
  • Loading branch information
sheepzh committed Jun 29, 2024
1 parent e802e88 commit 86fe7e1
Show file tree
Hide file tree
Showing 55 changed files with 651 additions and 79 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
"devDependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.24.7",
"@babel/preset-env": "^7.24.7",
"@crowdin/crowdin-api-client": "^1.33.1",
"@crowdin/crowdin-api-client": "^1.33.2",
"@types/chrome": "0.0.268",
"@types/copy-webpack-plugin": "^8.0.1",
"@types/echarts": "^4.9.22",
"@types/generate-json-webpack-plugin": "^0.3.7",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.2",
"@types/node": "^20.14.9",
"@types/psl": "^1.1.3",
"@types/punycode": "^2.1.4",
"@types/webpack": "^5.28.5",
Expand All @@ -41,7 +41,7 @@
"babel-loader": "^9.1.3",
"copy-webpack-plugin": "^12.0.2",
"css-loader": "^7.1.2",
"eslint": "^9.4.0",
"eslint": "^9.5.0",
"filemanager-webpack-plugin": "^8.0.0",
"generate-json-webpack-plugin": "^2.0.0",
"html-webpack-plugin": "^5.6.0",
Expand All @@ -51,27 +51,27 @@
"node-sass": "^9.0.0",
"sass-loader": "^14.2.1",
"style-loader": "^4.0.0",
"ts-jest": "^29.1.4",
"ts-jest": "^29.1.5",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"tslib": "^2.6.3",
"typescript": "5.4.5",
"typescript": "5.5.2",
"url-loader": "^4.1.1",
"webpack": "^5.91.0",
"webpack": "^5.92.1",
"webpack-bundle-analyzer": "^4.10.2",
"webpack-cli": "^5.1.4"
},
"dependencies": {
"@element-plus/icons-vue": "^2.3.1",
"@vueuse/core": "^10.10.0",
"@vueuse/core": "^10.11.0",
"countup.js": "^2.8.0",
"echarts": "^5.5.0",
"element-plus": "2.7.4",
"echarts": "^5.5.1",
"element-plus": "2.7.6",
"punycode": "^2.3.1",
"stream-browserify": "^3.0.0",
"vue": "^3.4.27",
"vue-router": "^4.3.2"
"vue": "^3.4.31",
"vue-router": "^4.4.0"
},
"engines": {
"node": ">=20"
Expand Down
3 changes: 3 additions & 0 deletions script/crowdin/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const ALL_TRANS_LOCALES: timer.Locale[] = [
'uk',
'es',
'de',
'fr',
]

const CROWDIN_I18N_MAP: Record<CrowdinLanguage, timer.Locale> = {
Expand All @@ -26,6 +27,7 @@ const CROWDIN_I18N_MAP: Record<CrowdinLanguage, timer.Locale> = {
uk: 'uk',
'es-ES': 'es',
de: 'de',
fr: 'fr',
}

const I18N_CROWDIN_MAP: Record<timer.Locale, CrowdinLanguage> = {
Expand All @@ -37,6 +39,7 @@ const I18N_CROWDIN_MAP: Record<timer.Locale, CrowdinLanguage> = {
uk: 'uk',
es: 'es-ES',
de: 'de',
fr: 'fr',
}

export const crowdinLangOf = (locale: timer.Locale) => I18N_CROWDIN_MAP[locale]
Expand Down
3 changes: 2 additions & 1 deletion script/crowdin/crowdin.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ type CrowdinLanguage =
| 'pt-PT'
| 'uk'
| 'es-ES'
| 'de'
| 'de'
| 'fr'
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const LOCALE_WIDTH: { [locale in timer.Locale]: number } = {
uk: 260,
es: 240,
de: 250,
fr: 230,
}

const _default = defineComponent({
Expand Down
5 changes: 1 addition & 4 deletions src/app/components/Option/components/BackupOption/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/

import type { Ref } from "vue"

import { t } from "@app/locale"
import optionService from "@service/option-service"
import processor from "@src/common/backup/processor"
Expand Down Expand Up @@ -180,7 +177,7 @@ const _default = defineComponent((_props, ctx) => {
style={{ width: "400px" }}
onInput={val => auth.value = val?.trim?.() || ''}
v-slots={{
append: () => <ElButton onClick={handleTest}>{t(msg => msg.option.backup.test)}</ElButton>
append: () => <ElButton onClick={handleTest}>{t(msg => msg.button.test)}</ElButton>
}}
/>
</OptionItem>
Expand Down
7 changes: 5 additions & 2 deletions src/app/components/Option/style/index.sass
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@
margin: 22px 10px 10px 10px
font-size: 14px
.option-line
display: flex
align-items: center
justify-content: space-between
gap: 10px
height: 30px
line-height: 30px
.el-input--small
height: 28px
.el-input__wrapper
Expand Down Expand Up @@ -67,8 +70,8 @@
color: #F56C6C
margin: 0 3px
.option-default
display: flex
color: var(--el-text-color-primary)
float: right
.el-tag
height: 20px
.option-container>span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const LOCALE_WIDTH: { [locale in timer.Locale]: number } = {
uk: 400,
es: 360,
de: 370,
fr: 330,
}
const _default = defineComponent({
emits: {
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/SiteManage/SiteManageModify/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const _default = defineComponent({
onClose={close}
v-slots={{
default: () => <ElForm model={formData} rules={formRule} ref={form}>
<ElFormItem prop="key" label={t(msg => msg.siteManage.column.host)}>
<ElFormItem prop="key" label={t(msg => msg.item.host)}>
<HostSelect modelValue={formData.key} onChange={val => formData.key = val} />
</ElFormItem>
<ElFormItem prop="alias" label={t(msg => msg.siteManage.column.alias)}>
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/SiteManage/SiteManageTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const _default = defineComponent({
fit
>
<ElTableColumn
label={t(msg => msg.siteManage.column.host)}
label={t(msg => msg.item.host)}
minWidth={120}
align="center"
v-slots={({ row }: ElTableRowScope<timer.site.SiteInfo>) => <HostAlert host={row.host} clickable={false} />}
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/Whitelist/WhitePanel/WhiteInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const _default = defineComponent({
class="input-new-tag editable-item whitelist-item-input"
modelValue={white.value}
onChange={setWhite}
placeholder={t(msg => msg.whitelist.placeholder)}
placeholder={t(msg => msg.item.host)}
clearable
onClear={() => setWhite()}
filterable
Expand Down
5 changes: 3 additions & 2 deletions src/app/router/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (c) 2021-present Hengyang Zhang
*
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
Expand All @@ -10,7 +10,8 @@ export const ANALYSIS_ROUTE = '/data/analysis'
export const OPTION_ROUTE = '/additional/option'

/**
* Use in the app page and background script
* Use on the app page and background script
*
* @since 0.2.2
*/
export const LIMIT_ROUTE = '/behavior/limit'
Expand Down
15 changes: 15 additions & 0 deletions src/app/styles/compatible.sass
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,18 @@ html[data-locale='uk']:root, html[data-locale='pt_PT']:root, html[data-locale='e
width: 135px
.el-picker-panel__body
margin-left: 135px
html[data-locale='de']:root
.el-date-range-picker
width: 761px
.el-picker-panel__sidebar
width: 115px
.el-picker-panel__body
margin-left: 115px

html[data-locale='fr']:root
.el-date-range-picker
width: 821px
.el-picker-panel__sidebar
width: 175px
.el-picker-panel__body
margin-left: 175px
14 changes: 11 additions & 3 deletions src/app/styles/index.sass
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,18 @@ a
align-items: center
user-select: none
.el-card__body
padding-bottom: 10px
padding-top: 18px
margin-bottom: 10px
display: flex
flex-wrap: wrap
padding-top: 20px
padding-bottom: 10px
>*
margin-bottom: 10px
.el-input
min-width: 180px
.el-select
min-width: 180px
.el-date-editor.el-input__wrapper
width: 280px

.filter-name
margin-right: 4px
Expand Down
2 changes: 1 addition & 1 deletion src/background/install-handler/uninstall-listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { setUninstallURL } from "@api/chrome/runtime"

async function listen() {
try {
const uninstallUrl = UNINSTALL_QUESTIONNAIRE[locale]
const uninstallUrl = UNINSTALL_QUESTIONNAIRE[locale] || UNINSTALL_QUESTIONNAIRE['en']
uninstallUrl && setUninstallURL(uninstallUrl)
} catch (e) {
console.error(e)
Expand Down
1 change: 1 addition & 0 deletions src/i18n/chrome/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const _default: { [locale in FakedLocale]: any } = {
uk: compile(messages.uk),
es: compile(messages.es),
de: compile(messages.de),
fr: compile(messages.fr),
}

export default _default
6 changes: 6 additions & 0 deletions src/i18n/chrome/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ const messages: Required<Messages<ChromeMessage>> = {
base: baseMessages.de,
contextMenus: contextMenusMessages.de,
initial: initialMessages.de,
},
fr: {
meta: metaMessages.fr,
base: baseMessages.fr,
contextMenus: contextMenusMessages.fr,
initial: initialMessages.fr,
}
}

Expand Down
1 change: 1 addition & 0 deletions src/i18n/element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const LOCALES: { [locale in timer.Locale]: () => Promise<{ default: Language }>
uk: () => import('element-plus/lib/locale/lang/uk'),
es: () => import('element-plus/lib/locale/lang/es'),
de: () => import('element-plus/lib/locale/lang/de'),
fr: () => import('element-plus/lib/locale/lang/fr'),
}

let EL_LOCALE: Language = null
Expand Down
5 changes: 3 additions & 2 deletions src/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const ALL_LOCALE_VALIDATOR: { [locale in timer.Locale]: 0 } = {
uk: 0,
es: 0,
de: 0,
fr: 0,
}

export const ALL_LOCALES: timer.Locale[] = Object.keys(ALL_LOCALE_VALIDATOR) as timer.Locale[]
Expand All @@ -44,13 +45,13 @@ const chrome2I18n: { [key: string]: timer.Locale } = {
'pt-PT': 'pt_PT',
'pt-BR': 'pt_PT',
'de': 'de',
'fr': 'fr',
}

const translationChrome2I18n: { [key: string]: timer.TranslatingLocale } = {
ko: 'ko',
pl: 'pl',
ru: 'ru',
fr: 'fr',
it: 'it',
sv: 'sv',
fi: 'fi',
Expand All @@ -70,7 +71,7 @@ const translationChrome2I18n: { [key: string]: timer.TranslatingLocale } = {
* Codes returned by getUILanguage() are defined by Chrome browser
* @see https://src.chromium.org/viewvc/chrome/trunk/src/third_party/cld/languages/internal/languages.cc
* But supported locale codes in Chrome extension
* @see https://developer.chrome.com/docs/webstore/i18n/#localeTable
* @see https://developer.chrome.com/docs/extensions/reference/api/i18n#locales
*
* They are different, so translate
*/
Expand Down
18 changes: 18 additions & 0 deletions src/i18n/message/app/about-resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,23 @@
"rate": "Classifique com 5 estrelas para ajudar os outros a saber~~",
"feedback": "Além disso, seja bem-vindo para enviar os seus comentários e solicitações de recursos!!"
}
},
"fr": {
"label": {
"name": "Nom",
"version": "Version actuelle",
"website": "Site Officiel",
"sourceCode": "Code Source",
"installation": "Page d'installation",
"thanks": "Merci à",
"privacy": "Déclaration de confidentialité",
"license": "Licence open source",
"support": "Soutien"
},
"text": {
"greet": "Aimez-vous cette extension ?",
"rate": "Donnez-lui 5 étoiles pour aider les autres à le savoir ~~",
"feedback": "Aussi, bienvenue pour soumettre vos commentaires et demandes de fonctionnalités !!"
}
}
}
27 changes: 27 additions & 0 deletions src/i18n/message/app/analysis-resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,5 +213,32 @@
"focusTitle": "Durchsuchen von Zeittrends",
"visitTitle": "Besuchen Sie Trends"
}
},
"fr": {
"common": {
"focusTotal": "Temps total de navigation",
"visitTotal": "Nombre total de visites",
"merged": "Fusionné",
"virtual": "Virtuel",
"hostPlaceholder": "Chercher un site à analyser",
"emptyDesc": "Aucun site sélectionné"
},
"summary": {
"title": "Bilan général",
"day": "Nombre total de jours actifs",
"firstDay": "Première visite {value}",
"calendarTitle": "Activité des dernières semaines"
},
"trend": {
"title": "Tendances",
"activeDay": "Jours actifs",
"totalDay": "Période de temps",
"maxFocus": "Temps de navigation maximum quotidien",
"averageFocus": "Durée moyenne de navigation quotidienne",
"maxVisit": "Visites maximales quotidiennes",
"averageVisit": "Visites moyennes quotidiennes",
"focusTitle": "Tendances sur le temps de navigation",
"visitTitle": "Tendances de visite"
}
}
}
23 changes: 23 additions & 0 deletions src/i18n/message/app/dashboard-resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,28 @@
"increase": "erhöht",
"decline": "verringert"
}
},
"fr": {
"heatMap": {
"title0": "Plus de {hour} heures parcourues au cours de l'année dernière",
"title1": "Parcouru moins d'une heure l'année dernière"
},
"topK": {
"title": "Top {k} des sites les plus visités les {day} derniers jours"
},
"indicator": {
"installedDays": "Installé depuis {number} jours",
"visitCount": "{site} visité {visit} fois",
"browsingTime": "Parcouru pendant {minute} minutes",
"mostUse": "Navigation favorite entre {start} et {end}"
},
"weekOnWeek": {
"title": "Top {k} du changement hebdomadaire de temps de navigation hebdomadaire",
"lastBrowse": "Parcouru {time} la semaine dernière",
"thisBrowse": "Parcouru {time} cette semaine",
"wow": "{delta} {state}",
"increase": "en hausse",
"decline": "en diminution"
}
}
}
Loading

0 comments on commit 86fe7e1

Please sign in to comment.