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