Translation infrastructure

This commit is contained in:
Eugene Pankov
2022-01-08 16:02:56 +01:00
parent 04010b58bb
commit 0814d44207
134 changed files with 8137 additions and 889 deletions

View File

@@ -1,16 +1,16 @@
ul.nav-tabs(ngbNav, #nav='ngbNav')
li(ngbNavItem)
a(ngbNavLink) General
a(ngbNavLink, translate) General
ng-template(ngbNavContent)
.form-group
label Host
label(translate) Host
input.form-control(
type='text',
[(ngModel)]='profile.options.host',
)
.form-group
label Port
label(translate) Port
input.form-control(
type='number',
placeholder='22',
@@ -20,7 +20,7 @@ ul.nav-tabs(ngbNav, #nav='ngbNav')
stream-processing-settings([options]='profile.options')
li(ngbNavItem)
a(ngbNavLink) Login scripts
a(ngbNavLink, translate) Login scripts
ng-template(ngbNavContent)
login-scripts-settings([options]='profile.options')

View File

@@ -8,4 +8,4 @@
button.btn.btn-sm.btn-link.mr-2((click)='reconnect()')
i.fas.fa-redo
span Reconnect
span(translate) Reconnect

View File

@@ -54,7 +54,7 @@ export class TelnetTabComponent extends BaseTerminalTabComponent {
// Session was closed abruptly
if (!this.reconnectOffered) {
this.reconnectOffered = true
this.write('Press any key to reconnect\r\n')
this.write(this.translate.instant('Press any key to reconnect') + '\r\n')
this.input$.pipe(first()).subscribe(() => {
if (!this.session?.open && this.reconnectOffered) {
this.reconnect()
@@ -77,7 +77,7 @@ export class TelnetTabComponent extends BaseTerminalTabComponent {
this.setSession(session)
try {
this.startSpinner('Connecting')
this.startSpinner(this.translate.instant('Connecting'))
this.attachSessionHandler(session.serviceMessage$, msg => {
this.write(`\r${colors.black.bgWhite(' Telnet ')} ${msg}\r\n`)
@@ -118,8 +118,11 @@ export class TelnetTabComponent extends BaseTerminalTabComponent {
return (await this.platform.showMessageBox(
{
type: 'warning',
message: `Disconnect from ${this.profile?.options.host}?`,
buttons: ['Disconnect', 'Do not close'],
message: this.translate.instant('Disconnect from {host}?', this.profile?.options),
buttons: [
this.translate.instant('Disconnect'),
this.translate.instant('Do not close'),
],
defaultId: 0,
cancelId: 1,
}

View File

@@ -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,10 +7,12 @@ export class TelnetHotkeyProvider extends HotkeyProvider {
hotkeys: HotkeyDescription[] = [
{
id: 'restart-telnet-session',
name: 'Restart current Telnet session',
name: this.translate.instant('Restart current Telnet session'),
},
]
constructor (private translate: TranslateService) { super() }
async provide (): Promise<HotkeyDescription[]> {
return this.hotkeys
}

View File

@@ -1,5 +1,5 @@
import { Injectable } from '@angular/core'
import { ProfileProvider, NewTabParameters, PartialProfile } from 'tabby-core'
import { ProfileProvider, NewTabParameters, PartialProfile, TranslateService } from 'tabby-core'
import { TelnetProfileSettingsComponent } from './components/telnetProfileSettings.component'
import { TelnetTabComponent } from './components/telnetTab.component'
import { TelnetProfile } from './session'
@@ -7,7 +7,7 @@ import { TelnetProfile } from './session'
@Injectable({ providedIn: 'root' })
export class TelnetProfilesService extends ProfileProvider<TelnetProfile> {
id = 'telnet'
name = 'Telnet'
name = this.translate.instant('Telnet')
supportsQuickConnect = false
settingsComponent = TelnetProfileSettingsComponent
configDefaults = {
@@ -22,12 +22,14 @@ export class TelnetProfilesService extends ProfileProvider<TelnetProfile> {
},
}
constructor (private translate: TranslateService) { super() }
async getBuiltinProfiles (): Promise<PartialProfile<TelnetProfile>[]> {
return [
{
id: `telnet:template`,
type: 'telnet',
name: 'Telnet session',
name: this.translate.instant('Telnet session'),
icon: 'fas fa-network-wired',
options: {
host: '',
@@ -43,7 +45,7 @@ export class TelnetProfilesService extends ProfileProvider<TelnetProfile> {
{
id: `socket:template`,
type: 'telnet',
name: 'Raw socket connection',
name: this.translate.instant('Raw socket connection'),
icon: 'fas fa-network-wired',
options: {
host: '',