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

i18n

parent a36baae1
# Mycard # Mycard
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.1.4.
## Development server ## Development server
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. download bin from CI
```
## Code scaffolding npm start
npm run start:electron
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. ```
## Build ## Build
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. ```
npm run build
## Running unit tests npm run dist
```
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Running end-to-end tests
Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
## Further help ## i18n
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page. ```bash
pip install transifex-client
export TX_TOKEN
```
...@@ -84,13 +84,15 @@ autoUpdater.on('update-downloaded', (event) => { ...@@ -84,13 +84,15 @@ autoUpdater.on('update-downloaded', (event) => {
updateWindow = new BrowserWindow({ updateWindow = new BrowserWindow({
width: 640, width: 640,
height: 360, height: 360,
autoHideMenuBar: true,
webPreferences: { nodeIntegration: true, contextIsolation: false, enableRemoteModule: true }
}); });
updateWindow.loadFile('projects/update/update.html'); updateWindow.loadFile('projects/update/update.html');
updateWindow.webContents.on('new-window', function (e, url) { updateWindow.webContents.on('new-window', function(e, url) {
e.preventDefault(); e.preventDefault();
shell.openExternal(url); shell.openExternal(url);
}); });
updateWindow.on('closed', function () { updateWindow.on('closed', function() {
updateWindow = null; updateWindow = null;
}); });
ipcMain.on('update', (event, arg) => { ipcMain.on('update', (event, arg) => {
...@@ -133,7 +135,7 @@ function createAria2c() { ...@@ -133,7 +135,7 @@ function createAria2c() {
'--min-split-size=1M', '--min-split-size=1M',
'--max-connection-per-server=10', '--max-connection-per-server=10',
'--remove-control-file', '--remove-control-file',
'--allow-overwrite', '--allow-overwrite'
], ],
{ stdio: 'ignore' } { stdio: 'ignore' }
); );
...@@ -153,8 +155,7 @@ async function createWindow() { ...@@ -153,8 +155,7 @@ async function createWindow() {
minHeight: 640, minHeight: 640,
frame: process.platform === 'darwin', frame: process.platform === 'darwin',
webPreferences: { nodeIntegration: true, contextIsolation: false, enableRemoteModule: true, webviewTag: true }, webPreferences: { nodeIntegration: true, contextIsolation: false, enableRemoteModule: true, webviewTag: true },
// transparent: process.platform != 'darwin', titleBarStyle: process.platform === 'darwin' ? 'hidden' : undefined
titleBarStyle: process.platform === 'darwin' ? 'hidden' : undefined,
}); });
// and load the index.html of the app. // and load the index.html of the app.
...@@ -164,7 +165,7 @@ async function createWindow() { ...@@ -164,7 +165,7 @@ async function createWindow() {
mainWindow.loadFile(path.join('dist/mycard', getLocale(), 'index.html')); mainWindow.loadFile(path.join('dist/mycard', getLocale(), 'index.html'));
} }
mainWindow.webContents.on('new-window', function (e, url) { mainWindow.webContents.on('new-window', function(e, url) {
e.preventDefault(); e.preventDefault();
shell.openExternal(url); shell.openExternal(url);
}); });
...@@ -175,7 +176,7 @@ async function createWindow() { ...@@ -175,7 +176,7 @@ async function createWindow() {
} }
// Emitted when the window is closed. // Emitted when the window is closed.
mainWindow.on('closed', function () { mainWindow.on('closed', function() {
// Dereference the window object, usually you would store windows // Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time // in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element. // when you should delete the corresponding element.
...@@ -204,13 +205,13 @@ function createTray() { ...@@ -204,13 +205,13 @@ function createTray() {
type: 'normal', type: 'normal',
click: () => { click: () => {
mainWindow.isVisible() ? mainWindow.hide() : mainWindow.show(); mainWindow.isVisible() ? mainWindow.hide() : mainWindow.show();
}, }
}, },
{ {
label: '退出', label: '退出',
type: 'normal', type: 'normal',
click: app.quit, click: app.quit
}, }
]); ]);
tray.setToolTip('MyCard'); tray.setToolTip('MyCard');
tray.setContextMenu(contextMenu); tray.setContextMenu(contextMenu);
...@@ -245,7 +246,7 @@ app.on('ready', async () => { ...@@ -245,7 +246,7 @@ app.on('ready', async () => {
}); });
// Quit when all windows are closed. // Quit when all windows are closed.
app.on('window-all-closed', function () { app.on('window-all-closed', function() {
// On OS X it is common for applications and their menu bar // On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q // to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
...@@ -253,7 +254,7 @@ app.on('window-all-closed', function () { ...@@ -253,7 +254,7 @@ app.on('window-all-closed', function () {
} }
}); });
app.on('activate', function () { app.on('activate', function() {
// On OS X it's common to re-create a window in the app when the // On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open. // dock icon is clicked and there are no other windows open.
if (mainWindow === null) { if (mainWindow === null) {
......
{ {
"name": "mycard", "name": "mycard",
"version": "3.1.0", "version": "3.0.0",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"start:electron": "electron .", "start:electron": "electron .",
"build": "ng build --localize --base-href ..", "build": "ng build --localize --base-href ..",
"watch": "ng build --localize --watch --configuration development", "watch": "ng build --localize --base-href .. --watch --configuration development",
"pack": "electron-builder --dir", "pack": "electron-builder --dir",
"dist": "electron-builder" "dist": "electron-builder",
"i18n:extract": "ng extract-i18n",
"i18n:upload": "tx push --source",
"i18n:translate": "open https://www.transifex.com/mycard/mycard/translate/#en_US/messages-xlf?q=translated%3Ano",
"i18n:download": "tx pull --all"
}, },
"main": "main.js", "main": "main.js",
"description": "萌卡客户端", "description": "萌卡客户端",
...@@ -80,7 +84,6 @@ ...@@ -80,7 +84,6 @@
"url": "https://cdn02.moecube.com:444/downloads" "url": "https://cdn02.moecube.com:444/downloads"
} }
], ],
"asar": false,
"files": [ "files": [
"main.js", "main.js",
"maotama.js", "maotama.js",
......
...@@ -51,12 +51,7 @@ ...@@ -51,12 +51,7 @@
var app = new Vue({ var app = new Vue({
el: '#vueApp', el: '#vueApp',
created: function() { created: function() {
let locale = localStorage.getItem('locale') || remote.app.getLocale(); const locale = remote.app.getLocale().startsWith('zh') ? 'zh-CN' : 'en-US';
if (locale.startsWith('zh-')) {
locale = 'zh-CN';
} else {
locale = 'en-US';
}
this.pageText = lang['update'][locale]; this.pageText = lang['update'][locale];
document.getElementById('title').innerHTML = this.pageText.pageTitle; document.getElementById('title').innerHTML = this.pageText.pageTitle;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<!--应用未购买--> <!--应用未购买-->
<div *ngIf="!currentApp.isBought()"> <div *ngIf="!currentApp.isBought()">
<button i18n type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#purchase-modal">{{currentApp.price.cny | currency:'CNY':true}} 购买</button> <button type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#purchase-modal">{{currentApp.price.cny | currency:'CNY':true}} <ng-container i18n>购买</ng-container></button>
<button i18n type="button" class="btn btn-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#install-modal">安装试玩版</button> <button i18n type="button" class="btn btn-secondary btn-sm" data-bs-toggle="modal" data-bs-target="#install-modal">安装试玩版</button>
<!--<button i18n (click)="updateInstallOption(currentApp)" type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#install-modal">我已经购买过</button>--> <!--<button i18n (click)="updateInstallOption(currentApp)" type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#install-modal">我已经购买过</button>-->
......
...@@ -257,31 +257,31 @@ ...@@ -257,31 +257,31 @@
<button i18n class="btn btn-secondary dropdown-toggle btn-sm" type="button" id="watchDropdownMenuButton" aria-haspopup="true" aria-expanded="false">游戏模式</button> <button i18n class="btn btn-secondary dropdown-toggle btn-sm" type="button" id="watchDropdownMenuButton" aria-haspopup="true" aria-expanded="false">游戏模式</button>
<div class="dropdown-menu"> <div class="dropdown-menu">
<h6 i18n class="dropdown-header">匹配</h6> <h6 i18n class="dropdown-header">匹配</h6>
<label i18n class="form-check dropdown-item"> <label class="form-check dropdown-item">
<input type="checkbox" class="form-check-input" [(ngModel)]="replay_rooms_filter.athletic"> <input type="checkbox" class="form-check-input" [(ngModel)]="replay_rooms_filter.athletic">
竞技匹配 <ng-container i18n>竞技匹配</ng-container>
</label> </label>
<label i18n class="form-check dropdown-item"> <label class="form-check dropdown-item">
<input type="checkbox" class="form-check-input" [(ngModel)]="replay_rooms_filter.entertain"> <input type="checkbox" class="form-check-input" [(ngModel)]="replay_rooms_filter.entertain">
娱乐匹配 <ng-container i18n>娱乐匹配</ng-container>
</label> </label>
<h6 i18n class="dropdown-header">自定义游戏</h6> <h6 i18n class="dropdown-header">自定义游戏</h6>
<label i18n class="form-check dropdown-item"> <label class="form-check dropdown-item">
<input type="checkbox" class="form-check-input" [(ngModel)]="replay_rooms_filter.single"> <input type="checkbox" class="form-check-input" [(ngModel)]="replay_rooms_filter.single">
单局模式 <ng-container i18n>单局模式</ng-container>
</label> </label>
<label i18n class="form-check dropdown-item"> <label class="form-check dropdown-item">
<input type="checkbox" class="form-check-input" [(ngModel)]="replay_rooms_filter.match"> <input type="checkbox" class="form-check-input" [(ngModel)]="replay_rooms_filter.match">
比赛模式 <ng-container i18n>比赛模式</ng-container>
</label> </label>
<label i18n class="form-check dropdown-item"> <label class="form-check dropdown-item">
<input type="checkbox" class="form-check-input" [(ngModel)]="replay_rooms_filter.tag"> <input type="checkbox" class="form-check-input" [(ngModel)]="replay_rooms_filter.tag">
TAG <ng-container i18n>TAG</ng-container>
</label> </label>
<h6 i18n class="dropdown-header">单人模式</h6> <h6 i18n class="dropdown-header">单人模式</h6>
<label i18n class="form-check dropdown-item"> <label class="form-check dropdown-item">
<input type="checkbox" class="form-check-input" [(ngModel)]="replay_rooms_filter.windbot"> <input type="checkbox" class="form-check-input" [(ngModel)]="replay_rooms_filter.windbot">
单人模式 <ng-container i18n>单人模式</ng-container>
</label> </label>
</div> </div>
</div> </div>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
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