fix: 优化音源设置国际化

This commit is contained in:
alger
2025-09-13 23:16:07 +08:00
parent c98f5bb608
commit 9003de8d4b
6 changed files with 81 additions and 17 deletions
+12
View File
@@ -86,12 +86,24 @@ export default {
parserGD: 'GD Music (Built-in)',
parserCustom: 'Custom API',
// Source labels
sourceLabels: {
migu: 'Migu',
kugou: 'Kugou',
pyncmd: 'NetEase (Built-in)',
bilibili: 'Bilibili',
gdmusic: 'GD Music',
custom: 'Custom API'
},
customApi: {
sectionTitle: 'Custom API Settings',
importConfig: 'Import JSON Config',
currentSource: 'Current Source',
notImported: 'No custom source imported yet.',
importSuccess: 'Successfully imported source: {name}',
importFailed: 'Import failed: {message}',
enableHint: 'Import a JSON config file to enable',
},
},
application: {
+12 -3
View File
@@ -81,10 +81,19 @@ export default {
showStatusBarContent: 'Macのステータスバーに音楽コントロール機能を表示できます(再起動後に有効)',
fallbackParser: '代替解析サービス (GD音楽台)',
fallbackParserDesc: '「GD音楽台」にチェックが入っていて、通常の音源で再生できない場合、このサービスが使用されます。',
parserGD: 'GD音楽台 (内蔵)',
parserCustom: 'カスタムAPI',
parserGD: 'GD 音楽台 (内蔵)',
parserCustom: 'カスタム API',
sourceLabels: {
migu: 'Migu',
kugou: 'Kugou',
pyncmd: 'NetEase (内蔵)',
bilibili: 'Bilibili',
gdmusic: 'GD 音楽台',
custom: 'カスタム API'
},
customApi: {
sectionTitle: 'カスタム API 設定',
enableHint: 'カスタム API を有効にするには、まずカスタム API をインポートする必要があります。',
importConfig: 'JSON設定をインポート',
currentSource: '現在の音源',
notImported: 'カスタム音源はまだインポートされていません。',
+12
View File
@@ -84,12 +84,24 @@ export default {
parserGD: 'GD Music (내장)',
parserCustom: '사용자 지정 API',
// 음원 라벨
sourceLabels: {
migu: 'Migu',
kugou: 'Kugou',
pyncmd: 'NetEase (내장)',
bilibili: 'Bilibili',
gdmusic: 'GD Music',
custom: '사용자 지정 API'
},
customApi: {
sectionTitle: '사용자 지정 API 설정',
importConfig: 'JSON 설정 가져오기',
currentSource: '현재 음원',
notImported: '아직 사용자 지정 음원을 가져오지 않았습니다.',
importSuccess: '음원 가져오기 성공: {name}',
importFailed: '가져오기 실패: {message}',
enableHint: '사용하려면 먼저 JSON 구성 파일을 가져오세요',
},
},
application: {
+12
View File
@@ -85,13 +85,25 @@ export default {
parserGD: 'GD 音乐台 (内置)',
parserCustom: '自定义 API',
// 音源标签
sourceLabels: {
migu: '咪咕音乐',
kugou: '酷狗音乐',
pyncmd: '网易云(内置)',
bilibili: 'Bilibili',
gdmusic: 'GD音乐台',
custom: '自定义 API'
},
// 自定义API相关的提示
customApi: {
sectionTitle: '自定义 API 设置',
importConfig: '导入 JSON 配置',
currentSource: '当前音源',
notImported: '尚未导入自定义音源。',
importSuccess: '成功导入音源: {name}',
importFailed: '导入失败: {message}',
enableHint: '请先导入 JSON 配置文件才能启用',
},
},
application: {
+12
View File
@@ -84,12 +84,24 @@ export default {
parserGD: 'GD 音樂台 (內建)',
parserCustom: '自訂 API',
// 音源標籤
sourceLabels: {
migu: '咪咕音樂',
kugou: '酷狗音樂',
pyncmd: '網易雲(內建)',
bilibili: 'Bilibili',
gdmusic: 'GD音樂台',
custom: '自訂 API'
},
customApi: {
sectionTitle: '自訂 API 設定',
importConfig: '匯入 JSON 設定',
currentSource: '目前音源',
notImported: '尚未匯入自訂音源。',
importSuccess: '成功匯入音源:{name}',
importFailed: '匯入失敗:{message}',
enableHint: '請先匯入 JSON 設定檔才能啟用',
},
},
application: {
@@ -16,7 +16,7 @@
<!-- 遍历常规音源 -->
<n-grid-item v-for="source in regularMusicSources" :key="source.value">
<n-checkbox :value="source.value">
{{ source.label }}
{{ t('settings.playback.sourceLabels.' + source.value) }}
<n-tooltip v-if="source.value === 'gdmusic'">
<template #trigger>
<n-icon size="16" class="ml-1 text-blue-500 cursor-help">
@@ -31,14 +31,14 @@
<!-- 单独处理自定义API选项 -->
<n-grid-item>
<n-checkbox value="custom" :disabled="!settingsStore.setData.customApiPlugin">
自定义 API
{{ t('settings.playback.sourceLabels.custom') }}
<n-tooltip v-if="!settingsStore.setData.customApiPlugin">
<template #trigger>
<n-icon size="16" class="ml-1 text-gray-400 cursor-help">
<i class="ri-question-line"></i>
</n-icon>
</template>
请先导入JSON配置文件才能启用
{{ t('settings.playback.customApi.enableHint') }}
</n-tooltip>
</n-checkbox>
</n-grid-item>
@@ -50,13 +50,20 @@
<!-- 自定义API导入区域 -->
<div>
<h3 class="text-base font-medium mb-2">自定义 API 设置</h3>
<h3 class="text-base font-medium mb-2">
{{ t('settings.playback.customApi.sectionTitle') }}
</h3>
<div class="flex items-center gap-4">
<n-button @click="importPlugin" size="small"> 导入 JSON 配置 </n-button>
<n-button @click="importPlugin" size="small">{{
t('settings.playback.customApi.importConfig')
}}</n-button>
<p v-if="settingsStore.setData.customApiPluginName" class="text-sm">
当前: <span class="font-semibold">{{ settingsStore.setData.customApiPluginName }}</span>
{{ t('settings.playback.customApi.currentSource') }}:
<span class="font-semibold">{{ settingsStore.setData.customApiPluginName }}</span>
</p>
<p v-else class="text-sm text-gray-500">
{{ t('settings.playback.customApi.notImported') }}
</p>
<p v-else class="text-sm text-gray-500">尚未导入</p>
</div>
</div>
</n-space>
@@ -95,11 +102,11 @@ const selectedSources = ref<ExtendedPlatform[]>(props.sources);
// 将常规音源和自定义音源分开定义
const regularMusicSources = ref([
{ label: 'MG', value: 'migu' },
{ label: 'KG', value: 'kugou' },
{ label: 'pyncmd', value: 'pyncmd' },
{ label: 'Bilibili', value: 'bilibili' },
{ label: 'GD音乐台', value: 'gdmusic' }
{ value: 'migu' },
{ value: 'kugou' },
{ value: 'pyncmd' },
{ value: 'bilibili' },
{ value: 'gdmusic' }
]);
const importPlugin = async () => {
@@ -107,14 +114,14 @@ const importPlugin = async () => {
const result = await window.api.importCustomApiPlugin();
if (result && result.name && result.content) {
settingsStore.setCustomApiPlugin(result);
message.success(`成功导入音源: ${result.name}`);
message.success(t('settings.playback.customApi.importSuccess', { name: result.name }));
// 导入成功后,如果用户还没勾选,则自动勾选上
if (!selectedSources.value.includes('custom')) {
selectedSources.value.push('custom');
}
}
} catch (error: any) {
message.error(`导入失败: ${error.message}`);
message.error(t('settings.playback.customApi.importFailed', { message: error.message }));
}
};