3 - Translated settings and common phrases.
This commit is contained in:
7
src/i18n/de/common-labels.ts
Normal file
7
src/i18n/de/common-labels.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { CommonLabels } from '../models';
|
||||
|
||||
export const COMMON_LABELS: CommonLabels = {
|
||||
folderDoesNotExist: 'Ordner exsistiert nicht in dem Verzeichnis:',
|
||||
settingsNotConfigured:
|
||||
'Die Einstellungen der Erweiterung "Lokale Parallelstellen" (Local Bible Ref) sind nicht eingerichtet. Bitte legen Sie den Pfad für die Bibeln fest, bevor Sie versuchen, auf Bibelabschnitte zu verweisen.',
|
||||
};
|
||||
@@ -1,7 +1,9 @@
|
||||
import { BOOKS } from './books';
|
||||
import { SETTINGS } from './settings';
|
||||
import { COMMON_LABELS } from './common-labels';
|
||||
import { SETTINGS_LABELS } from './settings-labels';
|
||||
|
||||
export const DE = {
|
||||
BOOKS,
|
||||
SETTINGS,
|
||||
COMMON: COMMON_LABELS,
|
||||
SETTINGS: SETTINGS_LABELS,
|
||||
};
|
||||
|
||||
86
src/i18n/de/settings-labels.ts
Normal file
86
src/i18n/de/settings-labels.ts
Normal file
@@ -0,0 +1,86 @@
|
||||
import { PassageFormat } from 'src/passage-reference';
|
||||
import { SettingsLabels } from '../models';
|
||||
import { QuoteReferencePosition } from 'src/settings';
|
||||
|
||||
export const SETTINGS_LABELS: SettingsLabels = {
|
||||
required: {
|
||||
name: 'Erforderliche Einstellungen',
|
||||
controls: {
|
||||
biblesPath: {
|
||||
name: 'Bibeldateien',
|
||||
description: 'Pfad zu den Bibeldateien',
|
||||
placeholder: 'z.B. Dateien/Bibel',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
optional: {
|
||||
name: 'Optionale Einstellungen',
|
||||
controls: {
|
||||
defaultVersion: {
|
||||
name: 'Standardversion',
|
||||
description:
|
||||
'Welche Bibelversion soll als Standardversion verwendet werden? Diese Abkürzung muss mit einem Ordner in dem oben angegebenen Pfad übereinstimmen.',
|
||||
placeholder: 'z.B. Schl2000',
|
||||
},
|
||||
defaultPassageFormat: {
|
||||
name: 'Standard Bibelstellenformat',
|
||||
description:
|
||||
'Welches Markdownformat soll für einen Bibelstelle standardmäßig ausgewählt werden?',
|
||||
options: {
|
||||
[PassageFormat.Manuscript]: 'Manuskript',
|
||||
[PassageFormat.Paragraph]: 'Abschnitt',
|
||||
[PassageFormat.Quote]: 'Zitat',
|
||||
[PassageFormat.Callout]: 'Callout',
|
||||
},
|
||||
},
|
||||
bibleFormat: {
|
||||
name: 'Bibelformat',
|
||||
description:
|
||||
'Der Formatierungsstil, den Sie für Ihre Vault-Bibeln verwenden. Local Bible Ref benötigt diesen, um Textpassagen korrekt zu analysieren.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
quoteFormat: {
|
||||
name: 'Einstellungen für das Angebotsformat',
|
||||
description: 'Einstellungen für das Zitatpassageformat.',
|
||||
controls: {
|
||||
includeReference: {
|
||||
name: 'Referenz angeben',
|
||||
description: 'Ob ein Verweis auf die Passage aufgenommen werden soll.',
|
||||
},
|
||||
referencePosition: {
|
||||
name: 'Referenzposition',
|
||||
description:
|
||||
'Die Position der Bezugnahme im Verhältnis zum zitierten Text.',
|
||||
options: {
|
||||
[QuoteReferencePosition.Beginning]: 'Anfang',
|
||||
[QuoteReferencePosition.End]: 'Ende',
|
||||
},
|
||||
},
|
||||
linkToPassage: {
|
||||
name: 'Link zur Passage',
|
||||
description:
|
||||
'Ob Sie den Verweis auf die Passage in Ihrer Tresorbibel verlinken möchten.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
calloutFormat: {
|
||||
name: 'Einstellungen für das Callout-Format',
|
||||
description: 'Einstellungen für das Format des Callout-Passages.',
|
||||
controls: {
|
||||
calloutType: {
|
||||
name: 'Callout-Typ',
|
||||
description:
|
||||
'Die Art des Verweises, der für die Passage verwendet werden soll.',
|
||||
},
|
||||
linkToPassage: {
|
||||
name: 'Link zur Passage',
|
||||
description:
|
||||
'Ob Sie den Verweis auf die Passage in Ihrer Tresorbibel verlinken möchten.',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -1,72 +0,0 @@
|
||||
import { SettingsLabels } from '../models';
|
||||
|
||||
export const SETTINGS: SettingsLabels = {
|
||||
required: {
|
||||
name: 'Required Settings',
|
||||
controls: {
|
||||
biblesPath: {
|
||||
name: 'Bible pathen',
|
||||
description: 'The path to the folder containing your bibles.',
|
||||
placeholder: 'e.g. Data/Bibles',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
optional: {
|
||||
name: 'Optional Settings',
|
||||
controls: {
|
||||
defaultVersion: {
|
||||
name: 'Default version',
|
||||
description:
|
||||
'The version to use by default - shorthand. This should correspond to a folder in the bibles folder selected above.',
|
||||
placeholder: 'e.g. NIV',
|
||||
},
|
||||
defaultPassageFormat: {
|
||||
name: 'Default passage format',
|
||||
description: 'The markdown format to use for passages by default.',
|
||||
},
|
||||
bibleFormat: {
|
||||
name: 'Bible format',
|
||||
description:
|
||||
'The formatting style you use for your vault bibles. Local Bible Ref relies on this to parse passages correctly.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
quoteFormat: {
|
||||
name: 'Quote Format Settings',
|
||||
description: 'Settings for the quote passage format.',
|
||||
controls: {
|
||||
includeReference: {
|
||||
name: 'Include reference',
|
||||
description: 'Whether to include a reference to the passage.',
|
||||
},
|
||||
referencePosition: {
|
||||
name: 'Reference position',
|
||||
description:
|
||||
'The position of the reference in relation to the quoted text.',
|
||||
},
|
||||
linkToPassage: {
|
||||
name: 'Link to passage',
|
||||
description:
|
||||
'Whether to link the reference to the passage in your vault Bible.',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
calloutFormat: {
|
||||
name: 'Callout Format Settings',
|
||||
description: 'Settings for the callout passage format.',
|
||||
controls: {
|
||||
calloutType: {
|
||||
name: 'Callout type',
|
||||
description: 'The type of callout to use for the passage.',
|
||||
},
|
||||
linkToPassage: {
|
||||
name: 'Link to passage',
|
||||
description:
|
||||
'Whether to link the reference to the passage in your vault Bible.',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
7
src/i18n/en/common-labels.ts
Normal file
7
src/i18n/en/common-labels.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { CommonLabels } from '../models';
|
||||
|
||||
export const COMMON_LABELS: CommonLabels = {
|
||||
folderDoesNotExist: "Folder doesn't exist at path:",
|
||||
settingsNotConfigured:
|
||||
'Local Bible Ref settings are not configured. Please set the bibles path before attempting to reference passages.',
|
||||
};
|
||||
@@ -1,7 +1,9 @@
|
||||
import { BOOKS } from './books';
|
||||
import { SETTINGS } from './settings';
|
||||
import { COMMON_LABELS } from './common-labels';
|
||||
import { SETTINGS_LABELS } from './settings-labels';
|
||||
|
||||
export const EN = {
|
||||
BOOKS,
|
||||
SETTINGS,
|
||||
COMMON: COMMON_LABELS,
|
||||
SETTINGS: SETTINGS_LABELS,
|
||||
};
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { PassageFormat } from 'src/passage-reference';
|
||||
import { SettingsLabels } from '../models';
|
||||
import { QuoteReferencePosition } from 'src/settings';
|
||||
|
||||
export const SETTINGS: SettingsLabels = {
|
||||
export const SETTINGS_LABELS: SettingsLabels = {
|
||||
required: {
|
||||
name: 'Required Settings',
|
||||
controls: {
|
||||
@@ -24,6 +26,12 @@ export const SETTINGS: SettingsLabels = {
|
||||
defaultPassageFormat: {
|
||||
name: 'Default passage format',
|
||||
description: 'The markdown format to use for passages by default.',
|
||||
options: {
|
||||
[PassageFormat.Manuscript]: 'Manuscript',
|
||||
[PassageFormat.Paragraph]: 'Paragraph',
|
||||
[PassageFormat.Quote]: 'Quote',
|
||||
[PassageFormat.Callout]: 'Callout',
|
||||
},
|
||||
},
|
||||
bibleFormat: {
|
||||
name: 'Bible format',
|
||||
@@ -45,6 +53,10 @@ export const SETTINGS: SettingsLabels = {
|
||||
name: 'Reference position',
|
||||
description:
|
||||
'The position of the reference in relation to the quoted text.',
|
||||
options: {
|
||||
[QuoteReferencePosition.Beginning]: 'Beginning',
|
||||
[QuoteReferencePosition.End]: 'End',
|
||||
},
|
||||
},
|
||||
linkToPassage: {
|
||||
name: 'Link to passage',
|
||||
@@ -1,22 +1,37 @@
|
||||
import { PassageFormat } from 'src/passage-reference';
|
||||
import { QuoteReferencePosition } from 'src/settings';
|
||||
|
||||
export interface Book {
|
||||
id: string;
|
||||
name: string;
|
||||
aliases: string[];
|
||||
}
|
||||
|
||||
export interface CommonLabels {
|
||||
folderDoesNotExist: string;
|
||||
settingsNotConfigured: string;
|
||||
}
|
||||
|
||||
export interface SettingsLabels {
|
||||
required: {
|
||||
name: string;
|
||||
controls: {
|
||||
biblesPath: ControlWithPlaceholder;
|
||||
biblesPath: TextControl;
|
||||
};
|
||||
};
|
||||
|
||||
optional: {
|
||||
name: string;
|
||||
controls: {
|
||||
defaultVersion: ControlWithPlaceholder;
|
||||
defaultPassageFormat: Control;
|
||||
defaultVersion: TextControl;
|
||||
defaultPassageFormat: Control & {
|
||||
options: {
|
||||
[PassageFormat.Manuscript]: string;
|
||||
[PassageFormat.Paragraph]: string;
|
||||
[PassageFormat.Quote]: string;
|
||||
[PassageFormat.Callout]: string;
|
||||
};
|
||||
};
|
||||
bibleFormat: Control;
|
||||
};
|
||||
};
|
||||
@@ -26,7 +41,12 @@ export interface SettingsLabels {
|
||||
description: string;
|
||||
controls: {
|
||||
includeReference: Control;
|
||||
referencePosition: Control;
|
||||
referencePosition: Control & {
|
||||
options: {
|
||||
[QuoteReferencePosition.Beginning]: string;
|
||||
[QuoteReferencePosition.End]: string;
|
||||
};
|
||||
};
|
||||
linkToPassage: Control;
|
||||
};
|
||||
};
|
||||
@@ -46,6 +66,6 @@ interface Control {
|
||||
description: string;
|
||||
}
|
||||
|
||||
interface ControlWithPlaceholder extends Control {
|
||||
interface TextControl extends Control {
|
||||
placeholder: string;
|
||||
}
|
||||
|
||||
@@ -16,11 +16,14 @@ import { SettingsLabels } from './i18n/models';
|
||||
import { I18N } from './i18n';
|
||||
|
||||
// STILL TODO:
|
||||
// - Need to add a 'common' labels internationalization file for non-settings labels. (e.g. notices)
|
||||
// - Need to sort out books in PassageReference to use I18N.
|
||||
// - Need to sort out smallcaps 'Lord' in German.
|
||||
|
||||
export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
private readonly hiddenClass = 'local-bible-ref-hidden';
|
||||
|
||||
private plugin: LocalBibleRefPlugin;
|
||||
private folderDoesNotExistText = '';
|
||||
private settingsLabels: SettingsLabels;
|
||||
|
||||
constructor(app: App, plugin: LocalBibleRefPlugin) {
|
||||
@@ -29,10 +32,12 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
|
||||
switch (getLanguage()) {
|
||||
case 'de':
|
||||
this.folderDoesNotExistText = I18N.DE.COMMON.folderDoesNotExist;
|
||||
this.settingsLabels = I18N.DE.SETTINGS;
|
||||
break;
|
||||
case 'en':
|
||||
default:
|
||||
this.folderDoesNotExistText = I18N.EN.COMMON.folderDoesNotExist;
|
||||
this.settingsLabels = I18N.EN.SETTINGS;
|
||||
break;
|
||||
}
|
||||
@@ -57,13 +62,9 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
.onChange(async (value) => {
|
||||
// toggle visibility of default version setting
|
||||
if (value) {
|
||||
defaultVersionSetting.settingEl.removeClass(
|
||||
'local-bible-ref-hidden'
|
||||
);
|
||||
defaultVersionSetting.settingEl.removeClass(this.hiddenClass);
|
||||
} else {
|
||||
defaultVersionSetting.settingEl.addClass(
|
||||
'local-bible-ref-hidden'
|
||||
);
|
||||
defaultVersionSetting.settingEl.addClass(this.hiddenClass);
|
||||
(
|
||||
defaultVersionSetting.components[0] as TextComponent
|
||||
).inputEl.value = '';
|
||||
@@ -78,7 +79,8 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
biblesPathTimeout = window.setTimeout(async () => {
|
||||
if (!path) return;
|
||||
const exists = this.app.vault.getFolderByPath(path);
|
||||
if (!exists) new Notice(`Folder doesn't exist at path: ${path}.`);
|
||||
if (!exists)
|
||||
new Notice(`${this.folderDoesNotExistText} ${path}.`);
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
@@ -105,7 +107,8 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
const exists = this.app.vault.getFolderByPath(
|
||||
normalizePath(path)
|
||||
);
|
||||
if (!exists) new Notice(`Folder doesn't exist at path: ${path}.`);
|
||||
if (!exists)
|
||||
new Notice(`${this.folderDoesNotExistText} ${path}.`);
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
@@ -113,9 +116,9 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
});
|
||||
|
||||
if (this.plugin.settings.biblesPath) {
|
||||
defaultVersionSetting.settingEl.removeClass('local-bible-ref-hidden');
|
||||
defaultVersionSetting.settingEl.removeClass(this.hiddenClass);
|
||||
} else {
|
||||
defaultVersionSetting.settingEl.addClass('local-bible-ref-hidden');
|
||||
defaultVersionSetting.settingEl.addClass(this.hiddenClass);
|
||||
}
|
||||
|
||||
new Setting(containerEl)
|
||||
@@ -123,12 +126,7 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
.setDesc(optional.controls.defaultPassageFormat.description)
|
||||
.addDropdown((dropdown) =>
|
||||
dropdown
|
||||
.addOptions({
|
||||
manuscript: 'Manuscript',
|
||||
paragraph: 'Paragraph',
|
||||
quote: 'Quote',
|
||||
callout: 'Callout',
|
||||
})
|
||||
.addOptions(optional.controls.defaultPassageFormat.options)
|
||||
.setValue(this.plugin.settings.defaultPassageFormat)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.defaultPassageFormat = value as PassageFormat;
|
||||
@@ -166,17 +164,11 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
.onChange(async (value) => {
|
||||
// toggle visibility of other paragraph reference settings
|
||||
if (value) {
|
||||
quoteRefPositionSetting.settingEl.removeClass(
|
||||
'local-bible-ref-hidden'
|
||||
);
|
||||
quoteRefLinkSetting.settingEl.removeClass(
|
||||
'local-bible-ref-hidden'
|
||||
);
|
||||
quoteRefPositionSetting.settingEl.removeClass(this.hiddenClass);
|
||||
quoteRefLinkSetting.settingEl.removeClass(this.hiddenClass);
|
||||
} else {
|
||||
quoteRefPositionSetting.settingEl.addClass(
|
||||
'local-bible-ref-hidden'
|
||||
);
|
||||
quoteRefLinkSetting.settingEl.addClass('local-bible-ref-hidden');
|
||||
quoteRefPositionSetting.settingEl.addClass(this.hiddenClass);
|
||||
quoteRefLinkSetting.settingEl.addClass(this.hiddenClass);
|
||||
}
|
||||
|
||||
this.plugin.settings.quote.includeReference = value;
|
||||
@@ -189,10 +181,7 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
.setDesc(quoteFormat.controls.referencePosition.description)
|
||||
.addDropdown((dropdown) =>
|
||||
dropdown
|
||||
.addOptions({
|
||||
beginning: 'Beginning',
|
||||
end: 'End',
|
||||
})
|
||||
.addOptions(quoteFormat.controls.referencePosition.options)
|
||||
.setValue(this.plugin.settings.quote.referencePosition)
|
||||
.onChange(async (value) => {
|
||||
this.plugin.settings.quote.referencePosition =
|
||||
@@ -214,11 +203,11 @@ export default class LocalBibleRefSettingTab extends PluginSettingTab {
|
||||
);
|
||||
|
||||
if (this.plugin.settings.quote.includeReference) {
|
||||
quoteRefPositionSetting.settingEl.removeClass('local-bible-ref-hidden');
|
||||
quoteRefLinkSetting.settingEl.removeClass('local-bible-ref-hidden');
|
||||
quoteRefPositionSetting.settingEl.removeClass(this.hiddenClass);
|
||||
quoteRefLinkSetting.settingEl.removeClass(this.hiddenClass);
|
||||
} else {
|
||||
quoteRefPositionSetting.settingEl.addClass('local-bible-ref-hidden');
|
||||
quoteRefLinkSetting.settingEl.addClass('local-bible-ref-hidden');
|
||||
quoteRefPositionSetting.settingEl.addClass(this.hiddenClass);
|
||||
quoteRefLinkSetting.settingEl.addClass(this.hiddenClass);
|
||||
}
|
||||
|
||||
new Setting(containerEl)
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
EditorSuggest,
|
||||
EditorSuggestContext,
|
||||
EditorSuggestTriggerInfo,
|
||||
getLanguage,
|
||||
normalizePath,
|
||||
Notice,
|
||||
TFile,
|
||||
@@ -13,14 +14,26 @@ import {
|
||||
import { BibleFormat } from './local-bible-ref-setting-tab';
|
||||
import PassageReference, { PassageFormat } from './passage-reference';
|
||||
import LocalBibleRefSettings, { QuoteReferencePosition } from './settings';
|
||||
import { I18N } from './i18n';
|
||||
|
||||
export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
|
||||
private settings: LocalBibleRefSettings;
|
||||
private settingsNotConfiguredText = '';
|
||||
private noSettingsNotice: Notice;
|
||||
|
||||
constructor(app: App, settings: LocalBibleRefSettings) {
|
||||
super(app);
|
||||
this.settings = settings;
|
||||
|
||||
switch (getLanguage()) {
|
||||
case 'de':
|
||||
this.settingsNotConfiguredText = I18N.DE.COMMON.settingsNotConfigured;
|
||||
break;
|
||||
case 'en':
|
||||
default:
|
||||
this.settingsNotConfiguredText = I18N.EN.COMMON.settingsNotConfigured;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
onTrigger(
|
||||
@@ -35,10 +48,7 @@ export default class PassageSuggest extends EditorSuggest<PassageSuggestion> {
|
||||
// if no settings, alert user
|
||||
if (!this.settings.biblesPath) {
|
||||
if (!this.noSettingsNotice?.messageEl.isShown()) {
|
||||
const noticeText =
|
||||
'Local Bible Ref settings are not ' +
|
||||
'configured. Please set the bibles path before ' +
|
||||
'attempting to reference passages.';
|
||||
const noticeText = this.settingsNotConfiguredText;
|
||||
this.noSettingsNotice = new Notice(noticeText);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user