diff --git a/.validate-files.ts b/.validate-files.ts index 2386aca0a2..785daf4c18 100644 --- a/.validate-files.ts +++ b/.validate-files.ts @@ -6,7 +6,6 @@ import * as glob from "glob"; let isValid = true; const validator = new json.Validator(undefined, undefined, { useDefaults: false }); let presetFiles: string[] = glob.sync("./files/presets/*.json") -console.log(presetFiles) let presetPromises: Promise[] = [] for(let i=0; i { console.log(isValid ? 'Valid' : 'Invalid'); process.exit(isValid ? 0 : 1); }); - diff --git a/src/lib/image-provider.ts b/src/lib/image-provider.ts index 7c86e33f31..86cd83fb21 100644 --- a/src/lib/image-provider.ts +++ b/src/lib/image-provider.ts @@ -2,6 +2,7 @@ import { ProviderPostEventMap, ProviderCallback, ProviderReceiveEventMap, Provid import { FuzzyService, LoggerService, SettingsService } from "../renderer/services"; import { imageProviders } from './image-providers'; import { availableProviders, providerInfo } from './image-providers/available-providers'; +import { providerInfoLang } from './image-providers/available-providers-lang'; import { APP } from '../variables'; import { queue } from "async"; import { Subject } from "rxjs"; @@ -64,6 +65,9 @@ export class ImageProvider { getProviderInfo(provider: string) { return providerInfo[provider]; } + getProviderInfoLang(provider: string) { + return providerInfoLang[provider]; + } retrieveUrls(title: string, imageType: string, imageProviderAPIs: ImageProviderAPI, providers: string[], eventCallback: ProviderCallback) { for (let i = 0; i < providers.length; i++) { diff --git a/src/lib/image-providers/available-providers-lang.ts b/src/lib/image-providers/available-providers-lang.ts new file mode 100644 index 0000000000..68ed75e045 --- /dev/null +++ b/src/lib/image-providers/available-providers-lang.ts @@ -0,0 +1,39 @@ +import { ProviderInfo } from '../../models'; +import { APP } from '../../variables'; +// necessary to split this out because of ts-node .validate-files +export const providerInfoLang: ProviderInfo = { + SteamGridDB: { + info: APP.lang.sgdbProvider.docs__md.self.join(''), + inputs: { + nsfw: { + label: APP.lang.sgdbProvider.nsfwInputTitle, + info: APP.lang.sgdbProvider.docs__md.input.join('') + }, + humor: { + label: APP.lang.sgdbProvider.humorInputTitle, + info: APP.lang.sgdbProvider.docs__md.input.join('') + }, + styles: { + label: APP.lang.sgdbProvider.stylesTitle, + info: APP.lang.sgdbProvider.docs__md.input.join('') + }, + stylesHero: { + label: APP.lang.sgdbProvider.stylesHeroTitle, + info: APP.lang.sgdbProvider.docs__md.input.join('') + }, + stylesLogo: { + label: APP.lang.sgdbProvider.stylesLogoTitle, + info: APP.lang.sgdbProvider.docs__md.input.join('') + }, + stylesIcon: { + label: APP.lang.sgdbProvider.stylesIconTitle, + info: APP.lang.sgdbProvider.docs__md.input.join('') + }, + imageMotionTypes: { + label: APP.lang.sgdbProvider.imageMotionTypesTitle, + info: APP.lang.sgdbProvider.docs__md.input.join('') + } + } + } +}; + diff --git a/src/lib/image-providers/available-providers.ts b/src/lib/image-providers/available-providers.ts index 7e3970a97d..342c35da98 100644 --- a/src/lib/image-providers/available-providers.ts +++ b/src/lib/image-providers/available-providers.ts @@ -1,59 +1,42 @@ import { ProviderInfo } from '../../models'; -import { APP } from '../../variables'; - export const providerInfo: ProviderInfo = { SteamGridDB: { - info: APP.lang.sgdbProvider.docs__md.self.join(''), inputs: { nsfw: { - label: APP.lang.sgdbProvider.nsfwInputTitle, inputType: 'toggle', - info: APP.lang.sgdbProvider.docs__md.input.join('') }, humor: { - label: APP.lang.sgdbProvider.humorInputTitle, inputType: 'toggle', - info: APP.lang.sgdbProvider.docs__md.input.join('') }, styles: { - label: APP.lang.sgdbProvider.stylesTitle, inputType: 'multiselect', allowedValues: ['alternate', 'blurred', 'white_logo', 'material', 'no_logo'], multiple: true, allowEmpty: true, - info: APP.lang.sgdbProvider.docs__md.input.join('') }, stylesHero: { - label: APP.lang.sgdbProvider.stylesHeroTitle, inputType: 'multiselect', allowedValues: ['alternate', 'blurred', 'material'], multiple: true, allowEmpty: true, - info: APP.lang.sgdbProvider.docs__md.input.join('') }, stylesLogo: { - label: APP.lang.sgdbProvider.stylesLogoTitle, inputType: 'multiselect', allowedValues: ['official', 'white', 'black', 'custom'], multiple: true, allowEmpty: true, - info: APP.lang.sgdbProvider.docs__md.input.join('') }, stylesIcon: { - label: APP.lang.sgdbProvider.stylesIconTitle, inputType: 'multiselect', allowedValues: ['official','custom'], multiple: true, allowEmpty: true, - info: APP.lang.sgdbProvider.docs__md.input.join('') }, imageMotionTypes: { - label: APP.lang.sgdbProvider.imageMotionTypesTitle, inputType: 'multiselect', allowedValues: ['static', 'animated'], multiple: true, allowEmpty: false, - info: APP.lang.sgdbProvider.docs__md.input.join('') } } } diff --git a/src/models/image-providers.model.ts b/src/models/image-providers.model.ts index bf2b34dee2..21b89c54c5 100644 --- a/src/models/image-providers.model.ts +++ b/src/models/image-providers.model.ts @@ -4,8 +4,8 @@ import { ImageProviderAPI } from "./user-configuration.model"; export interface ProviderInputField { [inputKey: string]: { - label: string, - inputType: 'multiselect' | 'toggle', + label?: string, + inputType?: 'multiselect' | 'toggle', info?: string, multiple?: boolean, allowEmpty?: boolean, diff --git a/src/renderer/components/parsers.component.ts b/src/renderer/components/parsers.component.ts index 41a24a198c..297451a837 100644 --- a/src/renderer/components/parsers.component.ts +++ b/src/renderer/components/parsers.component.ts @@ -343,6 +343,7 @@ export class ParsersComponent implements AfterViewInit, OnDestroy { let providerNames = this.imageProviderService.instance.getAvailableProviders(); for (let i=0;i < providerNames.length; i++) { let provider = this.imageProviderService.instance.getProviderInfo(providerNames[i]); + let providerL = this.imageProviderService.instance.getProviderInfoLang(providerNames[i]); if (provider && provider.inputs !== undefined) { imageProviderAPIs[providerNames[i]] = (()=>{ let apiInputs = {} @@ -350,12 +351,12 @@ export class ParsersComponent implements AfterViewInit, OnDestroy { let input = provider.inputs[inputFieldName]; if(input.inputType == 'toggle') { apiInputs[inputFieldName] = new NestedFormElement.Toggle({ - text: input.label + text: providerL.inputs[inputFieldName].label }); } else if (input.inputType == 'multiselect') { apiInputs[inputFieldName] = new NestedFormElement.Select({ - label: input.label, + label: providerL.inputs[inputFieldName].label, multiple: input.multiple, allowEmpty: input.allowEmpty, placeholder: this.lang.placeholder.multiAPIPlaceholder, @@ -367,7 +368,7 @@ export class ParsersComponent implements AfterViewInit, OnDestroy { }, onInfoClick: (self, path) => { this.currentDoc.activePath = path.join(); - this.currentDoc.content = input.info; + this.currentDoc.content = providerL.inputs[inputFieldName].info; } }) }