Skip to content

Commit

Permalink
fix(DeepLTranslator): broken search result item translations
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverschwendener committed Feb 16, 2024
1 parent 7b30d11 commit 99c4e25
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
18 changes: 15 additions & 3 deletions src/main/Extensions/AppearanceSwitcher/AppearanceSwitcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { Translator } from "@Core/Translator";
import type { OperatingSystem, SearchResultItem } from "@common/Core";
import type { Translations } from "@common/Core/Extension";
import type { Image } from "@common/Core/Image";
import { translations } from "./translations";

export class AppearanceSwitcher implements Extension {
public readonly id = "AppearanceSwitcher";
Expand All @@ -27,7 +26,7 @@ export class AppearanceSwitcher implements Extension {
) {}

public async getSearchResultItems(): Promise<SearchResultItem[]> {
const t = await this.translator.createInstance(translations);
const t = await this.translator.createInstance(this.getTranslations());

return [
{
Expand Down Expand Up @@ -68,6 +67,19 @@ export class AppearanceSwitcher implements Extension {
}

public getTranslations(): Translations {
return translations;
return {
"en-US": {
extensionName: "Appearance Switcher",
searchResultItemDescription: "System",
searchResultItemName: "Toggle System Appearance",
searchResultItemActionDescription: "Toggle System Appearance",
},
"de-CH": {
extensionName: "Erscheinungsbildwechsler",
searchResultItemDescription: "System",
searchResultItemName: "System-Farbschema umschalten",
searchResultItemActionDescription: "System-Farbschema umschalten",
},
};
}
}
16 changes: 0 additions & 16 deletions src/main/Extensions/AppearanceSwitcher/translations.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { getExtensionSettingKey, type Translations } from "@common/Core/Extensio
import type { Image } from "@common/Core/Image";
import type { Net } from "electron";
import type { ApiResponse, InvocationArgument, PostBody, Settings } from "./Types";
import { translations } from "./translations";

export class DeeplTranslatorExtension implements Extension {
public readonly id = "DeeplTranslator";
Expand Down Expand Up @@ -37,7 +36,7 @@ export class DeeplTranslatorExtension implements Extension {
) {}

public async getSearchResultItems(): Promise<SearchResultItem[]> {
const t = await this.translator.createInstance(translations);
const t = await this.translator.createInstance(this.getTranslations());

return [
{
Expand Down
3 changes: 0 additions & 3 deletions src/main/Extensions/DeeplTranslator/translations.ts

This file was deleted.

0 comments on commit 99c4e25

Please sign in to comment.