Skip to content

Commit 7ff2f42

Browse files
committed
Making settings simpler.
1 parent 92ab9f9 commit 7ff2f42

File tree

4 files changed

+5
-228
lines changed

4 files changed

+5
-228
lines changed

src/l10n/locale/de.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default {
4040
'View Information about the API\'s and the Plugin itself.': 'Schau dir mehr Informationen über die APIs und die Erweiterung an.',
4141
'More Info': 'Mehr Infos',
4242
'Donate': 'Spenden',
43-
'If you like this Plugin, consider donating to support continued development:': 'Wenn du die Erweiterung hilfreich findest, kannst du hier etwas spenden um die weitere Entwicklung zu unterstützen:',
43+
'If you found this plugin helpful, consider donating to support continued development.': 'Wenn du die Erweiterung hilfreich findest, kannst du hier etwas spenden um die weitere Entwicklung zu unterstützen:',
4444
'Local Dictionary Folder': 'Ordner für das Lokale Wörterbuch',
4545
'Specify a Folder, where all new Notes created by the Dictionary are placed. Please note that this Folder needs to already exist.': 'Gebe einen Ordner an, in dem alle vom Wörterbuch erstellten neuen Notizen abgelegt werden. Bitte beachte, dass dieser Ordner bereits vorhanden sein muss.',
4646
'Capitalize File Name': 'Dateinamen groß schreiben',

src/l10n/locale/en.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default {
4040
'View Information about the API\'s and the Plugin itself.': 'View Information about the API\'s and the Plugin itself.',
4141
'More Info': 'More Info',
4242
'Donate': 'Donate',
43-
'If you like this Plugin, consider donating to support continued development:': 'If you like this Plugin, consider donating to support continued development:',
43+
'If you found this plugin helpful, consider donating to support continued development.': 'If you found this plugin helpful, consider donating to support continued development.',
4444
'Local Dictionary Folder': 'Local Dictionary Folder',
4545
'Specify a Folder, where all new Notes created by the Dictionary are placed. Please note that this Folder needs to already exist.': 'Specify a Folder, where all new Notes created by the Dictionary are placed. Please note that this Folder needs to already exist.',
4646
'Capitalize File Name': 'Capitalize File Name',

src/l10n/locale/zh-cn.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default {
3737
'View Information about the API\'s and the Plugin itself.': '了解关于插件以及 API 的信息',
3838
'More Info': '更多信息',
3939
'Donate': '捐赠',
40-
'If you like this Plugin, consider donating to support continued development:': '如果你喜欢该插件,可以考虑打赏支持:',
40+
'If you found this plugin helpful, consider donating to support continued development.': '如果你喜欢该插件,可以考虑打赏支持:',
4141
'Local Dictionary Folder': '本地词典文件夹',
4242
'Specify a Folder, where all new Notes created by the Dictionary are placed. Please note that this Folder needs to already exist.': '指定词典创建的新笔记所存放的位置,注意文件夹需要存在',
4343

src/ui/settings/settingsTab.ts

Lines changed: 2 additions & 225 deletions
Original file line numberDiff line numberDiff line change
@@ -30,235 +30,12 @@ export default class SettingsTab extends PluginSettingTab {
3030
plugin.settings.defaultRefreshInterval = value;
3131
await this.save();
3232
}));
33-
new Setting(containerEl)
34-
.setName(t('Language'))
35-
.setDesc(t('The Language the Plugin will use to search for Definitions and Pronunciations.'))
36-
.addDropdown((dropdown) => {
37-
for (const language in LANGUAGES) {
38-
dropdown.addOption(language, LANGUAGES[language]);
39-
}
40-
dropdown.setValue(plugin.settings.defaultLanguage)
41-
.onChange(async (value) => {
42-
plugin.settings.defaultLanguage = value;
43-
await this.save();
44-
this.display();
45-
});
46-
});
47-
new Setting(containerEl)
48-
.setName(t('Definition Provider'))
49-
.setDesc(t('The API the Plugin will use to search for Definitions.'))
50-
.addDropdown((dropdown) => {
51-
for (const api of plugin.manager.definitionProvider) {
52-
if (api.supportedLanguages.contains(plugin.settings.defaultLanguage)) {
53-
dropdown.addOption(api.name, api.name);
54-
}
55-
}
56-
dropdown.setValue(plugin.settings.definitionApiName)
57-
.onChange(async (value) => {
58-
plugin.settings.definitionApiName = value;
59-
await this.save();
60-
});
61-
});
62-
new Setting(containerEl)
63-
.setName(t('Synonym Provider'))
64-
.setDesc(t('The API the Plugin will use to search for Synonyms.'))
65-
.addDropdown((dropdown) => {
66-
for (const api of plugin.manager.synonymProvider) {
67-
if (api.supportedLanguages.contains(plugin.settings.defaultLanguage)) {
68-
dropdown.addOption(api.name, api.name);
69-
}
70-
}
71-
dropdown.setValue(plugin.settings.synonymApiName)
72-
.onChange(async (value) => {
73-
plugin.settings.synonymApiName = value;
74-
await this.save();
75-
});
76-
});
77-
new Setting(containerEl)
78-
.setName(t('Synonym Suggestions'))
79-
.setDesc(t('Show synonyms for highlighted words'))
80-
.addToggle(toggle => {
81-
if (plugin.settings.shouldShowSynonymPopover) {
82-
toggle.setValue(true)
83-
} else {
84-
toggle.setValue(false)
85-
}
86-
87-
toggle.onChange(async (value) => {
88-
plugin.settings.shouldShowSynonymPopover = value;
89-
await this.save();
90-
})
91-
});
92-
const desc = document.createDocumentFragment();
93-
desc.append(
94-
t('Enabling this will allow the Plugin to analyze full sentences to better suggest synonyms based on the context.'),
95-
desc.createEl("br"),
96-
t('Click '),
97-
desc.createEl("a", {
98-
href: "https://github.com/phibr0/obsidian-dictionary#privacy",
99-
text: t('here')
100-
}),
101-
t(' for Privacy Concerns.'),
102-
);
103-
new Setting(containerEl)
104-
.setName(t('Advanced Synonym Search'))
105-
.setDesc(desc)
106-
.addToggle(toggle => {
107-
toggle.setValue(plugin.settings.advancedSynonymAnalysis)
108-
109-
toggle.onChange(async (value) => {
110-
plugin.settings.advancedSynonymAnalysis = value;
111-
await this.save();
112-
})
113-
});
114-
115-
new Setting(containerEl)
116-
.setName(t('Show Options in Context Menu'))
117-
.setDesc(t('Enable custom Context Menu with options to search for synonyms (only if the auto suggestions are disabled) and to look up a full definition in the Sidebar. Warning: This will override Obsidian\'s default Context Menu.'))
118-
.addToggle(toggle => {
119-
if (plugin.settings.shouldShowCustomContextMenu) {
120-
toggle.setValue(true)
121-
} else {
122-
toggle.setValue(false)
123-
}
124-
125-
toggle.onChange(async (value) => {
126-
plugin.settings.shouldShowCustomContextMenu = value;
127-
await this.save();
128-
})
129-
});
130-
containerEl.createEl('h3', { text: t("Local-Dictionary-Builder Settings") });
131-
new Setting(containerEl)
132-
.setName(t('Local Dictionary Folder'))
133-
.setDesc(t('Specify a Folder, where all new Notes created by the Dictionary are placed. Please note that this Folder needs to already exist.'))
134-
.addText(text => text
135-
.setPlaceholder(t('HackerNews'))
136-
.setValue(plugin.settings.folder)
137-
.onChange(async (value) => {
138-
plugin.settings.folder = value;
139-
await this.save();
140-
}));
141-
new Setting(containerEl)
142-
.setName(t('Use Language specific Subfolders'))
143-
.setDesc(t('Create Subfolders for every language, e.g. "Dictionary/en-US/Cake"'))
144-
.addToggle(toggle => {
145-
toggle.setValue(plugin.settings.languageSpecificSubFolders)
146-
toggle.onChange(async (value) => {
147-
plugin.settings.languageSpecificSubFolders = value;
148-
await this.save();
149-
})
150-
});
151-
new Setting(containerEl)
152-
.setName(t('Capitalize File Name'))
153-
.setDesc(t('If you disable this, the names of newly created files will be all lowercase.'))
154-
.addToggle(toggle => {
155-
toggle.setValue(plugin.settings.capitalizedFileName)
156-
toggle.onChange(async (value) => {
157-
plugin.settings.capitalizedFileName = value;
158-
await this.save();
159-
})
160-
});
161-
new Setting(containerEl)
162-
.setName(t('Filename Prefix and Suffix'))
163-
.setDesc(t('Here you can add a Prefix and Suffix for your newly created Files.'))
164-
.setClass("dictionaryprefixsuffix")
165-
.addText(text => text
166-
.setPlaceholder(t("Prefix"))
167-
.setValue(plugin.settings.prefix)
168-
.onChange(async (value) => {
169-
plugin.settings.prefix = value;
170-
await this.save();
171-
}))
172-
.addText(text => text
173-
.setPlaceholder(t("Suffix"))
174-
.setValue(plugin.settings.suffix)
175-
.onChange(async (value) => {
176-
plugin.settings.suffix = value;
177-
await this.save();
178-
}));
179-
const templateDescription = document.createDocumentFragment();
180-
templateDescription.append(
181-
t('Here you can edit the Template for newly created Files.'),
182-
templateDescription.createEl("br"),
183-
templateDescription.createEl("a", {
184-
href: "https://github.com/phibr0/obsidian-dictionary#variables",
185-
text: t('Click for a List of Variables'),
186-
}),
187-
);
188-
new Setting(containerEl)
189-
.setName(t('Template'))
190-
.setDesc(templateDescription)
191-
.setClass("dictionarytextarea")
192-
.addTextArea(text => text
193-
.setPlaceholder(DEFAULT_SETTINGS.template)
194-
.setValue(plugin.settings.template)
195-
.onChange(async (value) => {
196-
plugin.settings.template = value;
197-
await this.save();
198-
}))
199-
.addExtraButton(cb => {
200-
cb.setIcon("reset")
201-
.setTooltip(t("Reset to default"))
202-
.setDisabled(this.plugin.settings.template === DEFAULT_SETTINGS.template)
203-
.onClick(async () => {
204-
this.plugin.settings.template = DEFAULT_SETTINGS.template;
205-
await this.plugin.saveSettings();
206-
});
207-
});
208-
209-
containerEl.createEl('h3', { text: t("Caching Settings") });
210-
new Setting(containerEl)
211-
.setName(t("Use Caching"))
212-
.setDesc(t("Enable or disable caching. Caching provides a semi-offline experience by saving every result for later use."))
213-
.addToggle(toggle => {
214-
toggle.setValue(plugin.settings.useCaching)
215-
toggle.onChange(async (value) => {
216-
plugin.settings.useCaching = value;
217-
await this.save();
218-
})
219-
});
220-
const cachingInfo = document.createDocumentFragment();
221-
cachingInfo.append(
222-
t('Here you can delete all cached Data.'),
223-
templateDescription.createEl("br"),
224-
t("You currently have "),
225-
plugin.cache.cachedDefinitions.length.toString(),
226-
t(" cached Definitions and "),
227-
plugin.cache.cachedSynonyms.length.toString(),
228-
t(" cached Synonyms.")
229-
);
230-
new Setting(containerEl)
231-
.setName(t("Delete Cache"))
232-
.setDesc(cachingInfo)
233-
.addButton(button => {
234-
button.setDisabled(!plugin.settings.useCaching);
235-
button.setButtonText(t("Delete"));
236-
button.onClick(async () => {
237-
plugin.cache.cachedSynonyms = [];
238-
plugin.cache.cachedDefinitions = [];
239-
await this.plugin.saveCache();
240-
new Notice(t("Success"));
241-
this.display();
242-
});
243-
});
244-
245-
containerEl.createEl('h3', { text: t("Miscellaneous") });
246-
new Setting(containerEl)
247-
.setName(t('More Information'))
248-
.setDesc(t('View Information about the API\'s and the Plugin itself.'))
249-
.setClass("extra")
250-
.addButton((bt) => {
251-
bt.setButtonText(t('More Info'))
252-
bt.onClick((_) => {
253-
new InfoModal(plugin).open();
254-
});
255-
});
25633
new Setting(containerEl)
25734
.setName(t('Donate'))
258-
.setDesc(t('If you like this Plugin, consider donating to support continued development:'))
35+
.setDesc(t('If you found this plugin helpful, consider donating to support continued development.'))
25936
.setClass("extra")
26037
.addButton((bt) => {
261-
bt.buttonEl.outerHTML = `<a href="https://www.buymeacoffee.com/phibr0"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=phibr0&button_colour=5F7FFF&font_colour=ffffff&font_family=Inter&outline_colour=000000&coffee_colour=FFDD00"></a>`;
38+
bt.buttonEl.outerHTML = `<a href="https://www.buymeacoffee.com/arpitbhayani"><img src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=arpitbhayani&button_colour=5F7FFF&font_colour=ffffff&font_family=Inter&outline_colour=000000&coffee_colour=FFDD00"></a>`;
26239
});
26340
}
26441

0 commit comments

Comments
 (0)