refactor(localize): ensure compatibility with noImplicitOverride (#42512)

Adds the `override` keyword to the `localize` sources to ensure
compatibility with `noImplicitOverride`.

PR Close #42512
This commit is contained in:
Paul Gschwendtner 2021-06-07 21:05:34 +02:00 committed by Andrew Kushnir
parent 368576b045
commit bfc4c3cf43
4 changed files with 8 additions and 8 deletions

View File

@ -36,7 +36,7 @@ export class MessageSerializer<T> extends BaseVisitor {
return this.renderer.message;
}
visitElement(element: Element): void {
override visitElement(element: Element): void {
if (this.config.placeholder && element.name === this.config.placeholder.elementName) {
const name = getAttrOrThrow(element, this.config.placeholder.nameAttribute);
const body = this.config.placeholder.bodyAttribute &&
@ -55,18 +55,18 @@ export class MessageSerializer<T> extends BaseVisitor {
}
}
visitText(text: Text): void {
override visitText(text: Text): void {
this.renderer.text(text.value);
}
visitExpansion(expansion: Expansion): void {
override visitExpansion(expansion: Expansion): void {
this.renderer.startIcu();
this.renderer.text(`${expansion.switchValue}, ${expansion.type},`);
visitAll(this, expansion.cases);
this.renderer.endIcu();
}
visitExpansionCase(expansionCase: ExpansionCase): void {
override visitExpansionCase(expansionCase: ExpansionCase): void {
this.renderer.text(` ${expansionCase.value} {`);
this.renderer.startContainer();
visitAll(this, expansionCase.expression);

View File

@ -106,7 +106,7 @@ export class Xliff1TranslationParser implements TranslationParser<XmlTranslation
}
class XliffFileElementVisitor extends BaseVisitor {
visitElement(fileElement: Element): any {
override visitElement(fileElement: Element): any {
if (fileElement.name === 'file') {
return {fileElement, locale: getAttribute(fileElement, 'target-language')};
}
@ -114,7 +114,7 @@ class XliffFileElementVisitor extends BaseVisitor {
}
class XliffTranslationVisitor extends BaseVisitor {
visitElement(element: Element, bundle: ParsedTranslationBundle): void {
override visitElement(element: Element, bundle: ParsedTranslationBundle): void {
if (element.name === 'trans-unit') {
this.visitTransUnitElement(element, bundle);
} else {

View File

@ -90,7 +90,7 @@ interface TranslationVisitorContext {
}
class Xliff2TranslationVisitor extends BaseVisitor {
visitElement(element: Element, {bundle, unit}: TranslationVisitorContext): any {
override visitElement(element: Element, {bundle, unit}: TranslationVisitorContext): any {
if (element.name === 'unit') {
this.visitUnitElement(element, bundle);
} else if (element.name === 'segment') {

View File

@ -82,7 +82,7 @@ export class XtbTranslationParser implements TranslationParser<XmlTranslationPar
}
class XtbVisitor extends BaseVisitor {
visitElement(element: Element, bundle: ParsedTranslationBundle): any {
override visitElement(element: Element, bundle: ParsedTranslationBundle): any {
switch (element.name) {
case 'translation':
// Error if no `id` attribute