mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-07-08 10:27:31 +08:00
feat: 优化类型处理
This commit is contained in:
+5
-5
@@ -10,7 +10,7 @@ export const buildLanguageMessages = () => {
|
||||
const match = path.match(/\.\/lang\/([^/]+)\/([^/]+)\.ts$/);
|
||||
if (match) {
|
||||
const [, langCode, moduleName] = match;
|
||||
|
||||
|
||||
// 跳过 index 文件
|
||||
if (moduleName !== 'index') {
|
||||
if (!messages[langCode]) {
|
||||
@@ -45,16 +45,16 @@ export const getLanguageDisplayNames = (): Record<string, string> => {
|
||||
export const getLanguageOptions = () => {
|
||||
const supportedLanguages = getSupportedLanguages();
|
||||
const displayNames = getLanguageDisplayNames();
|
||||
|
||||
|
||||
// 按优先级排序
|
||||
const sortedLanguages = supportedLanguages.sort((a, b) => {
|
||||
const priorityA = LANGUAGE_PRIORITY[a] || 999;
|
||||
const priorityB = LANGUAGE_PRIORITY[b] || 999;
|
||||
return priorityA - priorityB;
|
||||
});
|
||||
|
||||
return sortedLanguages.map(lang => ({
|
||||
|
||||
return sortedLanguages.map((lang) => ({
|
||||
label: displayNames[lang] || lang,
|
||||
value: lang
|
||||
}));
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user