Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"electron-log": "^5.4.1",
"electron-store": "^10.1.0",
"electron-updater": "^6.6.5",
"fast-xml-parser": "^5.3.6",
"fast-xml-parser": "^5.3.8",
"fs-extra": "^11.3.0",
"ftp-srv": "^4.6.3",
"hpagent": "^1.2.0",
Expand Down
3 changes: 1 addition & 2 deletions src/lang/en/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"noPhpWarning": "Check that no PHP version is selected, a static site will be created, and the PHP files will cannot be executed. Are you sure to continue?",
"hostsWriteTips": "Enable / Disable all hosts in this list",
"sort": "Sort",

"projectPhp": "PHP Projects",
"projectJava": "Java Projects",
"projectNode": "Node Projects",
Expand All @@ -35,7 +34,7 @@
"projectDeno": "Deno Projects",
"projectBun": "Bun Projects",
"projectPerl": "Perl Projects",

"projectErlang": "Erlang Projects",
"jarPackagePath": "JAR Package Path",
"jdkPath": "JDK Path",
"pythonPath": "Python Path",
Expand Down
1 change: 1 addition & 0 deletions src/lang/es/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Proyectos Deno",
"projectBun": "Proyectos Bun",
"projectPerl": "Proyectos Perl",
"projectErlang": "Proyectos Erlang",
"jarPackagePath": "Ruta del paquete JAR",
"jdkPath": "Ruta de JDK",
"pythonPath": "Ruta de Python",
Expand Down
1 change: 1 addition & 0 deletions src/lang/fi/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Deno Projektit",
"projectBun": "Suorita Projektit",
"projectPerl": "Perl Projektit",
"projectErlang": "Erlang Projektit",
"jarPackagePath": "Jar Paketin Polku",
"jdkPath": "Jdk Polku",
"pythonPath": "Python Path",
Expand Down
1 change: 1 addition & 0 deletions src/lang/fr/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Projets Deno",
"projectBun": "Projets Bun",
"projectPerl": "Projets Perl",
"projectErlang": "Projets Erlang",
"jarPackagePath": "Chemin du package JAR",
"jdkPath": "Chemin JDK",
"pythonPath": "Chemin Python",
Expand Down
7 changes: 4 additions & 3 deletions src/lang/id/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
"projectGo": "Proyek Go",
"projectPython": "Proyek Python",
"projectTomcat": "Proyek Tomcat",
"projectDeno": "Deno Projects",
"projectBun": "Bun Projects",
"projectPerl": "Perl Projects",
"projectDeno": "Proyek Deno",
"projectBun": "Proyek Bun",
"projectPerl": "Proyek Perl",
"projectErlang": "Proyek Erlang",
"jarPackagePath": "Path Paket JAR",
"jdkPath": "Path JDK",
"pythonPath": "Path Python",
Expand Down
1 change: 0 additions & 1 deletion src/lang/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ let i18n: I18n
export const AppI18n = (l?: string): I18n => {
if (!i18n) {
i18n = createI18n({
legacy: true,
locale: l || 'en',
fallbackLocale: 'en',
messages: lang as any
Comment on lines 169 to 174
Copy link

Choose a reason for hiding this comment

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

Bug: The removal of legacy: true from createI18n makes i18n.global.locale a Ref. The direct assignment i18n.global.locale = l will fail, breaking language switching.
Severity: CRITICAL

Suggested Fix

When legacy: false (the new default), the locale must be updated by assigning to the .value property of the Ref. Change i18n.global.locale = l to i18n.global.locale.value = l to correctly update the language.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/lang/index.ts#L169-L174

Potential issue: By removing `legacy: true` from the `createI18n` call, the
`i18n.global.locale` property is changed from a plain string to a reactive `Ref` object.
The code subsequently attempts to assign a new language code directly via
`i18n.global.locale = l`. This assignment will fail because a `Ref`'s value must be
updated through its `.value` property. This will prevent the application's language from
being updated when a user tries to change it in the settings, breaking the language
switching functionality.

Did we get this right? 👍 / 👎 to inform future reviews.

Expand Down
7 changes: 4 additions & 3 deletions src/lang/it/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
"projectGo": "Progetti Go",
"projectPython": "Progetti Python",
"projectTomcat": "Progetti Tomcat",
"projectDeno": "Deno Projects",
"projectBun": "Bun Projects",
"projectPerl": "Perl Projects",
"projectDeno": "Progetti Deno",
"projectBun": "Progetti Bun",
"projectPerl": "Progetti Perl",
"projectErlang": "Progetti Erlang",
"jarPackagePath": "Percorso pacchetto JAR",
"jdkPath": "Percorso JDK",
"pythonPath": "Percorso Python",
Expand Down
7 changes: 4 additions & 3 deletions src/lang/ja/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
"projectGo": "Goプロジェクト",
"projectPython": "Pythonプロジェクト",
"projectTomcat": "Tomcatプロジェクト",
"projectDeno": "Deno Projects",
"projectBun": "Bun Projects",
"projectPerl": "Perl Projects",
"projectDeno": "Denoプロジェクト",
"projectBun": "Bunプロジェクト",
"projectPerl": "Perlプロジェクト",
"projectErlang": "Erlangプロジェクト",
"jarPackagePath": "JARパッケージパス",
"jdkPath": "JDKパス",
"pythonPath": "Pythonパス",
Expand Down
1 change: 1 addition & 0 deletions src/lang/nl/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Deno Projecten",
"projectBun": "Bun Projecten",
"projectPerl": "Projecten Perl",
"projectErlang": "Erlang Projecten",
"jarPackagePath": "JAR pakketpad",
"jdkPath": "JDK Pad",
"pythonPath": "Python Path",
Expand Down
1 change: 1 addition & 0 deletions src/lang/no/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Deno prosjekter",
"projectBun": "Bun Prosjekter",
"projectPerl": "Perl prosjekter",
"projectErlang": "Erlang prosjekter",
"jarPackagePath": "JAR pakkebane",
"jdkPath": "JDK sti",
"pythonPath": "Python Path",
Expand Down
1 change: 1 addition & 0 deletions src/lang/pl/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Projekty Deno",
"projectBun": "Projekty Bun",
"projectPerl": "Projekty Perl",
"projectErlang": "Projekty Erlang",
"jarPackagePath": "Ścieżka pakietu JAR",
"jdkPath": "Ścieżka JDK",
"pythonPath": "Python Path",
Expand Down
1 change: 1 addition & 0 deletions src/lang/pt-br/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Projeto Deno",
"projectBun": "Projeto Bun",
"projectPerl": "Projeto Perl",
"projectErlang": "Projeto Erlang",
"jarPackagePath": "Caminho do pacote jar",
"jdkPath": "Caminho do JDK",
"pythonPath": "Caminho do Python",
Expand Down
1 change: 1 addition & 0 deletions src/lang/pt/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Projeto Deno",
"projectBun": "Projeto Bun",
"projectPerl": "Projeto Perl",
"projectErlang": "Projeto Erlang",
"jarPackagePath": "Caminho do pacote jar",
"jdkPath": "Caminho do JDK",
"pythonPath": "Caminho do Python",
Expand Down
1 change: 1 addition & 0 deletions src/lang/ro/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Proiecte Deno",
"projectBun": "Proiecte de Bun",
"projectPerl": "Proiecte Perl",
"projectErlang": "Proiecte Erlang",
"jarPackagePath": "Calea JAR a pachetului",
"jdkPath": "Cale JDK",
"pythonPath": "Python Path",
Expand Down
1 change: 1 addition & 0 deletions src/lang/ru/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Проекты Deno",
"projectBun": "Bun Проекты",
"projectPerl": "Проекты Perl",
"projectErlang": "Проекты Erlang",
"jarPackagePath": "Путь к пакету JAR",
"jdkPath": "Путь JDK",
"pythonPath": "Python Path",
Expand Down
7 changes: 4 additions & 3 deletions src/lang/sv/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
"projectGo": "Go-projekt",
"projectPython": "Python-projekt",
"projectTomcat": "Tomcat-projekt",
"projectDeno": "Deno Projects",
"projectBun": "Bun Projects",
"projectPerl": "Perl Projects",
"projectDeno": "Deno-projekt",
"projectBun": "Bun-projekt",
"projectPerl": "Perl-projekt",
"projectErlang": "Erlang-projekt",
"jarPackagePath": "JAR-paket sökväg",
"jdkPath": "JDK-sökväg",
"pythonPath": "Python-sökväg",
Expand Down
1 change: 1 addition & 0 deletions src/lang/tr/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Deno Projeleri",
"projectBun": "Bun Projeleri",
"projectPerl": "Perl Projeleri",
"projectErlang": "Erlang Projeleri",
"jarPackagePath": "JAR Paket Yolu",
"jdkPath": "JDK Yolu",
"pythonPath": "Python Yolu",
Expand Down
1 change: 1 addition & 0 deletions src/lang/uk/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Проекти Deno",
"projectBun": "Проекти Bun",
"projectPerl": "Проекти Perl",
"projectErlang": "Проекти Erlang",
"jarPackagePath": "Шлях до пакета JAR",
"jdkPath": "Шлях JDK",
"pythonPath": "Шлях Python",
Expand Down
6 changes: 5 additions & 1 deletion src/lang/vi/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Dự án Deno",
"projectBun": "Dự án Bun",
"projectPerl": "Dự án Perl",
"projectErlang": "Dự án Erlang",
"jarPackagePath": "Đường dẫn gói JAR",
"jdkPath": "Đường dẫn JDK",
"pythonPath": "Đường dẫn Python",
Expand Down Expand Up @@ -67,5 +68,8 @@
"copyCommand": "Sao chép lệnh",
"showFile": "Hiển thị tệp",
"sticky": "Ghim",
"dbclickRowToEdit": "Nhấp đúp vào dòng này để chỉnh sửa"
"dbclickRowToEdit": "Nhấp đúp vào dòng này để chỉnh sửa",

"OnlineDomain": "Tên miền trực tuyến",
"LocalDoman": "Tên miền Local"

Choose a reason for hiding this comment

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

medium

There's a typo in the translation key. It should be LocalDomain to match the English key and avoid potential issues.

Suggested change
"LocalDoman": "Tên miền Local"
"LocalDomain": "Tên miền Local"

}
1 change: 1 addition & 0 deletions src/lang/zh/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"projectDeno": "Deno项目",
"projectBun": "Bun项目",
"projectPerl": "Perl项目",
"projectErlang": "Erlang项目",
"jarPackagePath": "jar包路径",
"jdkPath": "jdk路径",
"pythonPath": "Python路径",
Expand Down
11 changes: 6 additions & 5 deletions src/render/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import IPC from '@/util/IPC'
import { AppStore } from '@/store/app'
import { BrewStore } from '@/store/brew'
import { I18nT } from '@lang/index'
import { useI18n } from 'vue-i18n'
import Base from '@/core/Base'
import { MessageSuccess } from '@/util/Element'
import FloatButton from '@/components/FloatBtn/index.vue'
Expand All @@ -22,6 +22,7 @@
import { nativeTheme, shell } from '@/util/NodeFn'
import localForage from 'localforage'

const { t } = useI18n()
const appStore = AppStore()
const brewStore = BrewStore()

Expand Down Expand Up @@ -73,7 +74,7 @@
const showAbout = () => {
Base.Dialog(import('./components/About/index.vue'))
.className('about-dialog')
.title(I18nT('base.about'))
.title(t('base.about'))
.width('665px')
.noFooter()
.show()
Expand Down Expand Up @@ -144,7 +145,7 @@
console.log('sysetmProxy: ', res)
const proxy = res?.data ?? {}
if (Object.keys(proxy).length > 0) {
Base._Confirm(I18nT('tools.systemProxyCheck'), undefined, {
Base._Confirm(t('tools.systemProxyCheck'), undefined, {
customClass: 'confirm-del',
type: 'warning'
}).then(() => {
Expand All @@ -155,7 +156,7 @@
appStore.config.setup.proxy.on = true
appStore.config.setup.proxy.proxy = arr.join(' ')
appStore.saveConfig()
MessageSuccess(I18nT('tools.systemProxyUsed'))
MessageSuccess(t('tools.systemProxyUsed'))
})
localStorage.setItem('FlyEnv-Checked-Proxy', 'true')
}
Expand Down Expand Up @@ -198,7 +199,7 @@

onMounted(() => {
init()
brewStore.cardHeadTitle = I18nT('base.currentVersionLib')
brewStore.cardHeadTitle = t('base.currentVersionLib')
})

onUnmounted(() => {
Expand Down
19 changes: 10 additions & 9 deletions src/render/components/Conf/drawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,34 @@
</div>
<div class="tool gap-3">
<el-radio-group v-if="showCommond" v-model="type" size="small">
<el-tooltip :show-after="600" :content="I18nT('conf.rawFile')" placement="top">
<el-tooltip :show-after="600" :content="t('conf.rawFile')" placement="top">
<el-radio-button value="default">
<Document class="w-5 h-5 p-0.5" />
</el-radio-button>
</el-tooltip>
<el-tooltip :show-after="600" :content="I18nT('conf.CommonSetting')" placement="top">
<el-tooltip :show-after="600" :content="t('conf.CommonSetting')" placement="top">
<el-radio-button value="common">
<Operation class="w-5 h-5 p-0.5" />
</el-radio-button>
</el-tooltip>
</el-radio-group>
<el-button-group>
<el-tooltip :show-after="600" :content="I18nT('conf.open')" placement="top">
<el-tooltip :show-after="600" :content="t('conf.open')" placement="top">
<el-button :disabled="disabled" @click="openConfig">
<FolderOpened class="w-5 h-5 p-0.5" />
</el-button>
</el-tooltip>
<el-tooltip :show-after="600" :content="I18nT('conf.save')" placement="top">
<el-tooltip :show-after="600" :content="t('conf.save')" placement="top">
<el-button :disabled="disabled" @click="saveConfig">
<el-badge is-dot :offset="[8, 1]" :hidden="!changed">
<yb-icon :svg="import('@/svg/save.svg?raw')" class="w-5 h-5 p-0.5" />
</el-badge>
</el-button>
</el-tooltip>
<el-tooltip
v-if="showLoadDefault !== false"
v-if="showLoadDefault"
:show-after="600"
:content="I18nT('conf.loadDefault')"
:content="t('conf.loadDefault')"
placement="top"
>
<el-button :disabled="disabled || defaultDisabled" @click="getDefault">
Expand All @@ -45,12 +45,12 @@
</el-tooltip>
</el-button-group>
<el-button-group>
<el-tooltip :show-after="600" :content="I18nT('conf.loadCustom')" placement="top">
<el-tooltip :show-after="600" :content="t('conf.loadCustom')" placement="top">
<el-button :disabled="disabled" @click="loadCustom">
<yb-icon :svg="import('@/svg/custom.svg?raw')" class="w-5 h-5 p-0.5" />
</el-button>
</el-tooltip>
<el-tooltip :show-after="600" :content="I18nT('conf.saveCustom')" placement="top">
<el-tooltip :show-after="600" :content="t('conf.saveCustom')" placement="top">
<el-button :disabled="disabled" @click="saveCustom">
<yb-icon :svg="import('@/svg/saveas.svg?raw')" class="w-5 h-5 p-0.5" />
</el-button>
Expand All @@ -71,7 +71,8 @@
import { Document, Operation, FolderOpened } from '@element-plus/icons-vue'
import type { AllAppModule } from '@/core/type'
import { ConfSetup } from '@/components/Conf/setup'
import { I18nT } from '@lang/index'
import { useI18n } from 'vue-i18n'
const { t } = useI18n()
import type { SoftInstalled } from '@/store/brew'

const props = withDefaults(
Expand Down
7 changes: 4 additions & 3 deletions src/render/components/Deno/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
></Manager>
<ProjectIndex
v-else-if="tab === 2"
:title="I18nT('host.projectDeno')"
:title="t('host.projectDeno')"
:type-flag="'deno'"
></ProjectIndex>
</div>
Expand All @@ -33,9 +33,10 @@
import Service from '@/components/ServiceManager/base.vue'
import Manager from '../VersionManager/index.vue'
import { AppModuleSetup } from '@/core/Module'
import { I18nT } from '@lang/index'
import ProjectIndex from '@/components/LanguageProjects/index.vue'
import { useI18n } from 'vue-i18n'

const { t } = useI18n()
const { tab } = AppModuleSetup('deno')
const tabs = [I18nT('base.service'), I18nT('base.versionManager'), I18nT('host.projectDeno')]
const tabs = [t('base.service'), t('base.versionManager'), t('host.projectDeno')]
</script>
2 changes: 1 addition & 1 deletion src/render/components/Erlang/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
></Manager>
<ProjectIndex
v-else-if="tab === 2"
:title="`Erlang ${I18nT('base.projects')}`"
:title="I18nT('host.projectErlang')"

Choose a reason for hiding this comment

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

medium

This component still uses the legacy I18nT helper. To be consistent with the rest of the changes in this pull request, it should be updated to use the useI18n composition API. You'll need to import useI18n and initialize t in the <script setup> block, then use t() here and for defining tabs.

        :title="t('host.projectErlang')"

:type-flag="'erlang'"
>
</ProjectIndex>
Expand Down
Loading