Commit bcae0ce9 authored by 神楽坂玲奈's avatar 神楽坂玲奈

语言包优化

parent fa26571c
......@@ -6,7 +6,7 @@ import {App} from "./app";
import {DownloadService} from "./download.service";
import {clipboard, remote} from "electron";
import * as path from "path";
import * as fs from 'fs';
import * as fs from "fs";
declare const Notification: any;
declare const $: any;
......@@ -56,7 +56,13 @@ export class AppDetailComponent implements OnInit {
console.log(this.references);
this.referencesInstall = {};
for (let reference of this.references) {
this.referencesInstall[reference.id] = true;
if (reference.isLanguage()) {
// 对于语言包,只有在语言包的locales比游戏本身的更加合适的时候才默认勾选
// 这里先偷个懒,中文环境勾选中文语言包,非中文环境勾选非中文语言包
this.referencesInstall[reference.id] = reference.locales[0].startsWith('zh') == this.settingsService.getLocale().startsWith('zh')
} else {
this.referencesInstall[reference.id] = true;
}
}
}
......
......@@ -81,11 +81,16 @@ export class App {
status: AppStatus;
conference: string | undefined;
isLanguage() {
return this.category == Category.module && this.tags.includes('language');
}
reset() {
this.status.status = 'init';
this.local = null;
localStorage.removeItem(this.id);
}
isInstalled(): boolean {
return this.status.status != 'init';
}
......
import {Injectable, ApplicationRef, EventEmitter} from "@angular/core";
import {Http} from "@angular/http";
import {App, AppStatus, Action, Category} from "./app";
import {App, AppStatus, Action} from "./app";
import {SettingsService} from "./settings.sevices";
import * as fs from "fs";
import * as path from "path";
......@@ -239,7 +239,7 @@ export class AppsService {
'language_pack': '语言包'
}
};
if (!app.name && app.category == Category.module && app.tags.includes('language') && app.parent) {
if (!app.name && app.parent && app.isLanguage()) {
app.name = `${app.parent.name} ${lang[locale].language_pack} (${app.locales.map((l) => lang[locale][l]).join(', ')})`
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment