mirror of
https://github.com/Eugeny/tabby.git
synced 2025-07-19 18:07:58 +00:00
Translation infrastructure
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HotkeyDescription, HotkeyProvider } from 'tabby-core'
|
||||
import { HotkeyDescription, HotkeyProvider, TranslateService } from 'tabby-core'
|
||||
|
||||
/** @hidden */
|
||||
@Injectable()
|
||||
@@ -7,14 +7,16 @@ export class ElectronHotkeyProvider extends HotkeyProvider {
|
||||
hotkeys: HotkeyDescription[] = [
|
||||
{
|
||||
id: 'new-window',
|
||||
name: 'New window',
|
||||
name: this.translate.instant('New window'),
|
||||
},
|
||||
{
|
||||
id: 'toggle-window',
|
||||
name: 'Toggle terminal window',
|
||||
name: this.translate.instant('Toggle terminal window'),
|
||||
},
|
||||
]
|
||||
|
||||
constructor (private translate: TranslateService) { super() }
|
||||
|
||||
async provide (): Promise<HotkeyDescription[]> {
|
||||
return this.hotkeys
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ import { promisify } from 'util'
|
||||
import promiseIpc, { RendererProcessType } from 'electron-promise-ipc'
|
||||
import { execFile } from 'mz/child_process'
|
||||
import { Injectable, NgZone } from '@angular/core'
|
||||
import { PlatformService, ClipboardContent, HostAppService, Platform, MenuItemOptions, MessageBoxOptions, MessageBoxResult, FileUpload, FileDownload, FileUploadOptions, wrapPromise } from 'tabby-core'
|
||||
import { PlatformService, ClipboardContent, HostAppService, Platform, MenuItemOptions, MessageBoxOptions, MessageBoxResult, FileUpload, FileDownload, FileUploadOptions, wrapPromise, TranslateService } from 'tabby-core'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
import { ElectronHostWindow } from './hostWindow.service'
|
||||
import { ShellIntegrationService } from './shellIntegration.service'
|
||||
@@ -34,6 +34,7 @@ export class ElectronPlatformService extends PlatformService {
|
||||
private electron: ElectronService,
|
||||
private zone: NgZone,
|
||||
private shellIntegration: ShellIntegrationService,
|
||||
private translate: TranslateService,
|
||||
) {
|
||||
super()
|
||||
this.configPath = path.join(electron.app.getPath('userData'), 'config.yaml')
|
||||
@@ -204,7 +205,7 @@ export class ElectronPlatformService extends PlatformService {
|
||||
const result = await this.electron.dialog.showOpenDialog(
|
||||
this.hostWindow.getWindow(),
|
||||
{
|
||||
buttonLabel: 'Select',
|
||||
buttonLabel: this.translate.instant('Select'),
|
||||
properties,
|
||||
},
|
||||
)
|
||||
|
@@ -2,7 +2,7 @@ import type { AppUpdater } from 'electron-updater'
|
||||
import { Injectable } from '@angular/core'
|
||||
import axios from 'axios'
|
||||
|
||||
import { Logger, LogService, ConfigService, UpdaterService, PlatformService } from 'tabby-core'
|
||||
import { Logger, LogService, ConfigService, UpdaterService, PlatformService, TranslateService } from 'tabby-core'
|
||||
import { ElectronService } from '../services/electron.service'
|
||||
|
||||
const UPDATES_URL = 'https://api.github.com/repos/eugeny/tabby/releases/latest'
|
||||
@@ -18,6 +18,7 @@ export class ElectronUpdaterService extends UpdaterService {
|
||||
constructor (
|
||||
log: LogService,
|
||||
config: ConfigService,
|
||||
private translate: TranslateService,
|
||||
private platform: PlatformService,
|
||||
private electron: ElectronService,
|
||||
) {
|
||||
@@ -132,8 +133,11 @@ export class ElectronUpdaterService extends UpdaterService {
|
||||
if ((await this.platform.showMessageBox(
|
||||
{
|
||||
type: 'warning',
|
||||
message: 'Installing the update will close all tabs and restart Tabby.',
|
||||
buttons: ['Update', 'Cancel'],
|
||||
message: this.translate.instant('Installing the update will close all tabs and restart Tabby.'),
|
||||
buttons: [
|
||||
this.translate.instant('Update'),
|
||||
this.translate.instant('Cancel'),
|
||||
],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
}
|
||||
|
Reference in New Issue
Block a user