From 78631d6c52b33b2a15e85dd3e2a20654a0821369 Mon Sep 17 00:00:00 2001 From: Johannes Theiner Date: Mon, 27 Jun 2022 09:35:21 +0200 Subject: [PATCH] fix translation mistake --- manifest.json | 2 +- package.json | 2 +- src/l10n/locales/de.ts | 2 +- src/l10n/locales/en.ts | 17 ++++--- src/modals/FilteredFolderModal.ts | 81 ++++++++++++++----------------- src/parser/rssParser.ts | 1 - src/settings/FilterSettings.ts | 4 +- versions.json | 3 +- 8 files changed, 53 insertions(+), 59 deletions(-) diff --git a/manifest.json b/manifest.json index e2bccef..e7df12a 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "rss-reader", "name": "RSS Reader", - "version": "1.2.1", + "version": "1.2.2", "minAppVersion": "0.13.33", "description": "Read RSS Feeds from within obsidian", "author": "Johannes Theiner", diff --git a/package.json b/package.json index 571642f..9964f1c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rss-reader", - "version": "1.2.1", + "version": "1.2.2", "description": "Read RSS Feeds from inside obsidian", "main": "main.js", "scripts": { diff --git a/src/l10n/locales/de.ts b/src/l10n/locales/de.ts index c94a3c8..d6d8723 100644 --- a/src/l10n/locales/de.ts +++ b/src/l10n/locales/de.ts @@ -101,7 +101,7 @@ export default { from_feeds: "Aus Feeds: ", with_tags: "Mit Tags: ", - + no_feed_with_name: "Es existiert kein Feed mit diesem Namen", invalid_tag: "Dieser Tag ist nicht gültig", note_exists: "Es existiert bereits eine Notiz mit diesem Namen", diff --git a/src/l10n/locales/en.ts b/src/l10n/locales/en.ts index 7c338c8..cb9b3f8 100644 --- a/src/l10n/locales/en.ts +++ b/src/l10n/locales/en.ts @@ -9,11 +9,11 @@ export default { //commands open: "Open", refresh_feeds: "Refresh feeds", - create_all: "Create wallabag.xml", + create_all: "Create all", //folder actions - mark_all_as_read: "Mark wallabag.xml as read", - add_tags_to_all: "Add tags to wallabag.xml entries", + mark_all_as_read: "Mark all as read", + add_tags_to_all: "Add tags to all entries", filtered_folders: "Filtered Folders", folders: "Folders", @@ -76,7 +76,7 @@ export default { invalid_feed: "This feed does not have any entries", //filter types - filter_tags: "wallabag.xml articles with tags", + filter_tags: "All articles with tags", filter_unread: "All unread articles(from folders)", filter_read: "All read articles(from folders)", filter_favorites: "Favorites(from folders)", @@ -105,6 +105,7 @@ export default { from_feeds: "from feeds: ", with_tags: "with tags: ", + no_feed_with_name: "There is no feed with this name", invalid_tag: "This is not a valid tag", note_exists: "there is already a note with that name", @@ -166,15 +167,15 @@ export default { //cleanup modal cleanup: "Cleanup articles", - cleanup_help: "Removes wallabag.xml entries which fit the criteria specified below.", - cleanup_help2: "Keep in mind that wallabag.xml articles that still exist in the feed will reappear on the next refresh", + cleanup_help: "Removes entries which fit the criteria specified below.", + cleanup_help2: "Keep in mind that articles that still exist in the feed will reappear on the next refresh", perform_cleanup: "Perform cleanup", all: "all", from_feed: "from feed", older_than: "older than X Days", - older_than_help: "keep empty for wallabag.xml, will be ignored if there is no publishing date associated with entry", + older_than_help: "keep empty for all, will be ignored if there is no publishing date associated with entry", advanced: "Advanced", - remove_wrong_feed: "Remove wallabag.xml articles that are in the incorrect feed", + remove_wrong_feed: "Remove all articles that are in the incorrect feed", remove_wrong_feed_help: "This might have happened due to a bug in versions pre 0.8", scanning_items: "Scanning Articles (%1 / %2)", diff --git a/src/modals/FilteredFolderModal.ts b/src/modals/FilteredFolderModal.ts index 0027a70..62b8d86 100644 --- a/src/modals/FilteredFolderModal.ts +++ b/src/modals/FilteredFolderModal.ts @@ -20,7 +20,7 @@ export enum SortOrder { ALPHABET_INVERTED } -export interface FilteredFolder{ +export interface FilteredFolder { name: string; filterTags: string[]; ignoreTags: string[]; @@ -55,7 +55,7 @@ export class FilteredFolderModal extends BaseModal { super(plugin.app); this.plugin = plugin; - if(folder) { + if (folder) { this.name = folder.name; this.sortOrder = folder.sortOrder; this.filterTags = folder.filterTags; @@ -70,8 +70,8 @@ export class FilteredFolderModal extends BaseModal { } } - async display() : Promise { - const { contentEl } = this; + async display(): Promise { + const {contentEl} = this; contentEl.empty(); @@ -122,8 +122,8 @@ export class FilteredFolderModal extends BaseModal { const sorting = new Setting(contentEl) .setName(t("sort")) .addDropdown((dropdown: DropdownComponent) => { - for(const order in SortOrder) { - if(order.length > 1) { + for (const order in SortOrder) { + if (order.length > 1) { // @ts-ignore dropdown.addOption(order, t("sort_" + order.toLowerCase())); } @@ -157,7 +157,7 @@ export class FilteredFolderModal extends BaseModal { .addExtraButton((button) => { button .setTooltip(t("delete")) - .setIcon("feather-trash") + .setIcon("trash") .onClick(() => { this.filterFolders = this.filterFolders.filter(e => e !== this.filterFolders[folder]); this.display(); @@ -238,22 +238,16 @@ export class FilteredFolderModal extends BaseModal { feedsDiv.createEl("p", {text: t("filter_feed_help")}); const feeds = this.plugin.settings.feeds.filter(feed => { - if(this.filterFolders.length === 0) + if (this.filterFolders.length === 0) return true; return this.filterFolders.contains(feed.folder); }).map((feed) => feed.name); for (const feed in this.filterFeeds) { new Setting(feedsDiv) - .addSearch(async (search: SearchComponent) => { - new ArraySuggest(this.app, search.inputEl, new Set(feeds)); - search - .setValue(this.filterFeeds[feed]) - .onChange(async (value: string) => { - this.removeValidationError(search); - this.filterFeeds = this.filterFeeds.filter(e => e !== this.filterFeeds[feed]); - this.filterFeeds.push(value); - }); + .addText(text => { + text.setDisabled(true) + .setValue(this.filterFeeds[feed]); }) .addExtraButton((button) => { button @@ -273,6 +267,11 @@ export class FilteredFolderModal extends BaseModal { new ArraySuggest(this.app, search.inputEl, new Set(feeds)); search .onChange(async (value: string) => { + const feeds = this.plugin.settings.feeds.filter(feed => feed.name === feedIgnoreValue).length; + if(feeds !== 1) { + this.setValidationError(search, t("no_feed_with_name")); + return; + } feedValue = value; }); }).addExtraButton(button => { @@ -280,6 +279,9 @@ export class FilteredFolderModal extends BaseModal { .setTooltip(t("add")) .setIcon("plus") .onClick(() => { + const feeds = this.plugin.settings.feeds.filter(feed => feed.name === feedIgnoreValue).length; + if(feeds !== 1) return; + this.filterFeeds.push(feedValue); this.display(); }); @@ -289,24 +291,18 @@ export class FilteredFolderModal extends BaseModal { feedsDiv.createEl("p", {text: t("filter_feed_ignore_help")}); //ignore feeds - for (const folder in this.ignoreFeeds) { + for (const feed in this.ignoreFeeds) { new Setting(feedsDiv) - .addSearch(async (search: SearchComponent) => { - new ArraySuggest(this.app, search.inputEl, new Set(feeds)); - search - .setValue(this.ignoreFeeds[folder]) - .onChange(async (value: string) => { - this.removeValidationError(search); - this.ignoreFeeds = this.ignoreFeeds.filter(e => e !== this.ignoreFeeds[folder]); - this.ignoreFeeds.push(value); - }); + .addText(text => { + text.setDisabled(true) + .setValue(this.ignoreFeeds[feed]); }) .addExtraButton((button) => { button .setTooltip(t("delete")) .setIcon("trash") .onClick(() => { - this.ignoreFeeds = this.ignoreFeeds.filter(e => e !== this.ignoreFeeds[folder]); + this.ignoreFeeds = this.ignoreFeeds.filter(e => e !== this.ignoreFeeds[feed]); this.display(); }); @@ -319,6 +315,11 @@ export class FilteredFolderModal extends BaseModal { new ArraySuggest(this.app, search.inputEl, new Set(feeds)); search .onChange(async (value: string) => { + const feeds = this.plugin.settings.feeds.filter(feed => feed.name === feedIgnoreValue).length; + if (feeds !== 1) { + this.setValidationError(search, t("no_feed_with_name")); + return; + } feedIgnoreValue = value; }); }).addExtraButton(button => { @@ -326,6 +327,9 @@ export class FilteredFolderModal extends BaseModal { .setTooltip(t("add")) .setIcon("plus") .onClick(() => { + const feeds = this.plugin.settings.feeds.filter(feed => feed.name === feedIgnoreValue).length; + if (feeds !== 1) return; + this.ignoreFeeds.push(feedIgnoreValue); this.display(); }); @@ -339,19 +343,9 @@ export class FilteredFolderModal extends BaseModal { for (const tag in this.filterTags) { new Setting(tagDiv) - .addSearch(async (search: SearchComponent) => { - new ArraySuggest(this.app, search.inputEl, get(tagsStore)); - search + .addText(text => { + text.setDisabled(true) .setValue(this.filterTags[tag]) - .onChange(async (value: string) => { - this.removeValidationError(search); - if (!value.match(TAG_REGEX) || value.match(NUMBER_REGEX) || value.contains(" ") || value.contains('#')) { - this.setValidationError(search, t("invalid_tag")); - return; - } - this.filterTags = this.filterTags.filter(e => e !== this.filterTags[tag]); - this.filterTags.push(value); - }); }) .addExtraButton((button) => { button @@ -463,12 +457,12 @@ export class FilteredFolderModal extends BaseModal { .setIcon("checkmark") .onClick(async () => { let error = false; - if(!nameText.getValue().length) { + if (!nameText.getValue().length) { this.setValidationError(nameText, t("invalid_name")); error = true; } - if(error) { + if (error) { new Notice(t("fix_errors")); return; } @@ -489,8 +483,7 @@ export class FilteredFolderModal extends BaseModal { } - - async onOpen() : Promise { + async onOpen(): Promise { await this.display(); } } diff --git a/src/parser/rssParser.ts b/src/parser/rssParser.ts index 9312a2c..8a5d9d4 100644 --- a/src/parser/rssParser.ts +++ b/src/parser/rssParser.ts @@ -207,7 +207,6 @@ export async function getFeedItems(feed: RssFeed): Promise { try { const rawData = await requestFeed(feed); data = new window.DOMParser().parseFromString(rawData, "text/xml"); - console.log(data); } catch (e) { console.error(e); return Promise.resolve(undefined); diff --git a/src/settings/FilterSettings.ts b/src/settings/FilterSettings.ts index 6d5820c..1e631ee 100644 --- a/src/settings/FilterSettings.ts +++ b/src/settings/FilterSettings.ts @@ -75,11 +75,11 @@ export function displayFilterSettings(plugin: RssReaderPlugin, containerEl: HTML const folders = filter.filterFolders.join(","); message += "; " + t("from_folders") + folders; } - if (filter.filterFeeds.length > 0) { + if (filter.filterFeeds !== undefined && filter.filterFeeds.length > 0) { const feeds = filter.filterFeeds.join(","); message += "; " + t("from_feeds") + feeds; } - if (filter.filterTags.length > 0) { + if (filter.filterTags !== undefined && filter.filterTags.length > 0) { const tags = filter.filterTags.join(","); message += "; " + t("with_tags") + tags; } diff --git a/versions.json b/versions.json index 9aee36c..2defff6 100644 --- a/versions.json +++ b/versions.json @@ -27,5 +27,6 @@ "1.0.5": "0.12.17", "1.1.0": "0.12.17", "1.2.0": "0.13.33", - "1.2.1": "0.13.33" + "1.2.1": "0.13.33", + "1.2.2": "0.13.33" }