Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: minor l10n and typing fixes #503

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Observable } from 'rxjs';
import { TranslocoService } from '@ngneat/transloco';
import { Injectable } from '@angular/core';
import { ControlSchemeBindingType } from '@app/shared-misc';
import { ControlSchemeBindingInputs, ControlSchemeGearboxBinding, ControlSchemeInput, GearboxBindingInputAction, PortCommandTask } from '@app/store';
import { ControlSchemeInput, GearboxBindingInputAction, PortCommandTask } from '@app/store';

import { IBindingL10n } from '../i-binding-l10n';
import { DirectionAwareControllerInputNameService } from '../common';
Expand All @@ -27,7 +27,7 @@ export class GearboxBindingL10nService implements IBindingL10n<ControlSchemeBind
}

public getBindingInputName(
actionType: keyof ControlSchemeGearboxBinding['inputs']
actionType: GearboxBindingInputAction
): Observable<string> {
switch (actionType) {
case GearboxBindingInputAction.NextGear:
Expand All @@ -40,7 +40,7 @@ export class GearboxBindingL10nService implements IBindingL10n<ControlSchemeBind
}

public getControllerInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.Gearbox>,
actionType: GearboxBindingInputAction,
inputConfig: ControlSchemeInput
): Observable<string> {
switch (actionType) {
Expand Down
13 changes: 3 additions & 10 deletions modules/bindings/src/lib/servo/servo-binding-l10n.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,7 @@ import { Observable, filter, switchMap } from 'rxjs';
import { TranslocoService } from '@ngneat/transloco';
import { Store } from '@ngrx/store';
import { ControlSchemeBindingType } from '@app/shared-misc';
import {
ATTACHED_IO_PROPS_SELECTORS,
AttachedIoPropsModel,
ControlSchemeBindingInputs,
ControlSchemeInput,
PortCommandTask,
ServoBindingInputAction
} from '@app/store';
import { ATTACHED_IO_PROPS_SELECTORS, AttachedIoPropsModel, ControlSchemeInput, PortCommandTask, ServoBindingInputAction } from '@app/store';

import { IBindingL10n } from '../i-binding-l10n';
import { DirectionAwareControllerInputNameService } from '../common';
Expand Down Expand Up @@ -39,7 +32,7 @@ export class ServoBindingL10nService implements IBindingL10n<ControlSchemeBindin
}

public getBindingInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.Servo>,
actionType: ServoBindingInputAction,
): Observable<string> {
switch (actionType) {
case ServoBindingInputAction.Cw:
Expand All @@ -50,7 +43,7 @@ export class ServoBindingL10nService implements IBindingL10n<ControlSchemeBindin
}

public getControllerInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.Servo>,
actionType: ServoBindingInputAction,
inputConfig: ControlSchemeInput
): Observable<string> {
switch (actionType) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Store } from '@ngrx/store';
import {
ATTACHED_IO_PROPS_SELECTORS,
AttachedIoPropsModel,
ControlSchemeBindingInputs,
ControlSchemeInput,
ControlSchemeSetAngleBinding,
PortCommandTask,
Expand Down Expand Up @@ -41,14 +40,14 @@ export class SetAngleBindingL10nService implements IBindingL10n<ControlSchemeBin
}

public getBindingInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.SetAngle>,
actionType: SetAngleBindingInputAction,
binding: ControlSchemeSetAngleBinding
): Observable<string> {
return this.transloco.selectTranslate('controlScheme.setAngleBinding.inputAction', binding);
}

public getBasicInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.SetAngle>
actionType: SetAngleBindingInputAction
): Observable<string> {
switch (actionType) {
case SetAngleBindingInputAction.SetAngle:
Expand All @@ -57,7 +56,7 @@ export class SetAngleBindingL10nService implements IBindingL10n<ControlSchemeBin
}

public getControllerInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.SetAngle>,
actionType: SetAngleBindingInputAction,
inputConfig: ControlSchemeInput
): Observable<string> {
switch (actionType) {
Expand Down
6 changes: 3 additions & 3 deletions modules/bindings/src/lib/speed/speed-binding-l10n.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Observable } from 'rxjs';
import { TranslocoService } from '@ngneat/transloco';
import { Injectable } from '@angular/core';
import { ControlSchemeBindingType, calculateSpeedPower } from '@app/shared-misc';
import { ControlSchemeBindingInputs, ControlSchemeInput, PortCommandTask, SpeedBindingInputAction } from '@app/store';
import { ControlSchemeInput, PortCommandTask, SpeedBindingInputAction } from '@app/store';

import { IBindingL10n } from '../i-binding-l10n';
import { DirectionAwareControllerInputNameService } from '../common';
Expand All @@ -28,7 +28,7 @@ export class SpeedBindingL10nService implements IBindingL10n<ControlSchemeBindin
}

public getBindingInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.Speed>
actionType: SpeedBindingInputAction
): Observable<string> {
switch (actionType) {
case SpeedBindingInputAction.Forwards:
Expand All @@ -41,7 +41,7 @@ export class SpeedBindingL10nService implements IBindingL10n<ControlSchemeBindin
}

public getControllerInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.Speed>,
actionType: SpeedBindingInputAction,
inputConfig: ControlSchemeInput
): Observable<string> {
switch (actionType) {
Expand Down
10 changes: 5 additions & 5 deletions modules/bindings/src/lib/stepper/stepper-binding-l10n.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Observable } from 'rxjs';
import { TranslocoService } from '@ngneat/transloco';
import { Injectable } from '@angular/core';
import { ControlSchemeBindingType } from '@app/shared-misc';
import { ControlSchemeBinding, ControlSchemeBindingInputs, ControlSchemeInput, PortCommandTask, StepperBindingInputAction } from '@app/store';
import { ControlSchemeInput, ControlSchemeStepperBinding, PortCommandTask, StepperBindingInputAction } from '@app/store';

import { IBindingL10n } from '../i-binding-l10n';
import { DirectionAwareControllerInputNameService } from '../common';
Expand All @@ -28,8 +28,8 @@ export class StepperBindingL10nService implements IBindingL10n<ControlSchemeBind
}

public getBindingInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.Stepper>,
binding: ControlSchemeBinding & { bindingType: ControlSchemeBindingType.Stepper }
actionType: StepperBindingInputAction,
binding: ControlSchemeStepperBinding
): Observable<string> {
switch (actionType) {
case StepperBindingInputAction.Cw:
Expand All @@ -40,7 +40,7 @@ export class StepperBindingL10nService implements IBindingL10n<ControlSchemeBind
}

public getBasicInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.Stepper>
actionType: StepperBindingInputAction
): Observable<string> {
switch (actionType) {
case StepperBindingInputAction.Cw:
Expand All @@ -51,7 +51,7 @@ export class StepperBindingL10nService implements IBindingL10n<ControlSchemeBind
}

public getControllerInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.Stepper>,
actionType: StepperBindingInputAction,
inputConfig: ControlSchemeInput
): Observable<string> {
switch (actionType) {
Expand Down
10 changes: 5 additions & 5 deletions modules/bindings/src/lib/train/train-binding-l10n.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { TranslocoService } from '@ngneat/transloco';
import { MOTOR_LIMITS } from 'rxpoweredup';
import { ControlSchemeBindingInputs, ControlSchemeInput, PortCommandTask, TrainBindingInputAction } from '@app/store';
import { ControlSchemeInput, PortCommandTask, TrainBindingInputAction } from '@app/store';
import { ControlSchemeBindingType } from '@app/shared-misc';

import { IBindingL10n } from '../i-binding-l10n';
Expand All @@ -28,20 +28,20 @@ export class TrainBindingL10nService implements IBindingL10n<ControlSchemeBindin
}

public getBindingInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.Train>,
actionType: TrainBindingInputAction,
): Observable<string> {
switch (actionType) {
case TrainBindingInputAction.NextSpeed:
return this.translocoService.selectTranslate('controlScheme.trainBinding.prevLevel');
return this.translocoService.selectTranslate('controlScheme.trainBinding.nextSpeed');
case TrainBindingInputAction.PrevSpeed:
return this.translocoService.selectTranslate('controlScheme.trainBinding.nextLevel');
return this.translocoService.selectTranslate('controlScheme.trainBinding.prevSpeed');
case TrainBindingInputAction.Reset:
return this.translocoService.selectTranslate('controlScheme.trainBinding.reset');
}
}

public getControllerInputName(
actionType: keyof ControlSchemeBindingInputs<ControlSchemeBindingType.Train>,
actionType: TrainBindingInputAction,
inputConfig: ControlSchemeInput
): Observable<string> {
switch (actionType) {
Expand Down
4 changes: 2 additions & 2 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@
"outputLevelAdd": "Add speed",
"outputLevelRemove": "Remove speed",
"taskSummary": "Train, speed #{level} ({speedPercent}%){ isLooping, select, true { (mirror)} other {}}",
"nextLevel": "Next speed",
"prevLevel": "Prev speed",
"nextSpeed": "Next speed",
"prevSpeed": "Prev speed",
"reset": "Set speed #0"
},
"gearboxBinding": {
Expand Down
4 changes: 2 additions & 2 deletions src/assets/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@
"outputLevelAdd": "Добавить скорость",
"outputLevelRemove": "Удалить скорость",
"taskSummary": "Поезд, скорость №{level} ({speedPercent}%){ isLooping, select, true { (инв.)} other {}}",
"nextLevel": "Следующая скорость",
"prevLevel": "Предыдущая скорость",
"nextSpeed": "Следующая скорость",
"prevSpeed": "Предыдущая скорость",
"reset": "Скорость №0"
},
"gearboxBinding": {
Expand Down
Loading