Skip to content

Commit

Permalink
+ Include Chinese Translation(References #72, closes #74)
Browse files Browse the repository at this point in the history
~ some more translatable values
+ Context menu on filtered folders(Closes #69)
  • Loading branch information
joethei committed Jan 18, 2022
1 parent 157c331 commit 1d1a89b
Show file tree
Hide file tree
Showing 9 changed files with 70 additions and 36 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "rss-reader",
"name": "RSS Reader",
"version": "1.0.5",
"version": "1.1.0",
"minAppVersion": "0.12.17",
"description": "Read RSS Feeds from within obsidian",
"author": "Johannes Theiner",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rss-reader",
"version": "1.0.5",
"version": "1.1.0",
"description": "Read RSS Feeds from inside obsidian",
"main": "main.js",
"scripts": {
Expand All @@ -26,7 +26,7 @@
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"chai": "^4.3.4",
"esbuild": "^0.14.2",
"esbuild": "0.13.15",
"esbuild-svelte": "^0.6.0",
"eslint": "^7.32.0",
"jsdom": "^19.0.0",
Expand Down
6 changes: 3 additions & 3 deletions src/l10n/locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import en from "./locales/en";
import de from "./locales/de";
import zh from "./locales/zh";

const locale = window.moment.locale;
const locale = window.moment.locale();

const localeMap: { [k: string]: Partial<typeof en> } = {
en,
de,
zh
"zh-cn": zh
};

const userLocale = localeMap[locale()];
const userLocale = localeMap[locale];

export default function t(str: keyof typeof en, ...inserts: string[]): string {
let localeStr = (userLocale && userLocale[str]) ?? en[str];
Expand Down
17 changes: 16 additions & 1 deletion src/l10n/locales/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,20 @@ export default {
filter_feed_ignore_help: "diese Feeds ignorieren",
filter_tags_ignore_help: "diese Tags ignorieren",

loading: "Lädt"
loading: "Lädt",

//template settings
article_title: "Titel",
article_link: "Link zum Artikel",
article_author: "Autor",
article_published: "Veröffentlichungsdatum",
article_description: "Kurze Beschreibung des Artikels",
article_content: "Inhalt des Artikels",
article_tags: "Tags getrennt durch Komma",
article_media: "Link zu Video/Audio Datei",
feed_folder: "Ordner des Feeds",
feed_title: "Feed Titel",
highlights: "Highlights",
note_created: "Erstelldatum der Notiz",
filename: "Dateiname"
}
17 changes: 16 additions & 1 deletion src/l10n/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,5 +194,20 @@ export default {
filter_feed_ignore_help: "ignore the following feeds",
filter_tags_ignore_help: "ignore the following tags",

loading: "Loading"
loading: "Loading",

//template settings
article_title: "Title",
article_link: "Link to article",
article_author: "Author of article",
article_published: "Date published",
article_description: "Short article description",
article_content: "article content",
article_tags: "Tags split by comma",
article_media: "Link to video/audio file",
feed_folder: "Folder of feed",
feed_title: "Title of feed",
highlights: "Highlights",
note_created: "Note creation date",
filename: "Filename"
}
50 changes: 25 additions & 25 deletions src/settings/SettingsTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ export class RSSReaderSettingsTab extends PluginSettingTab {

const templateDesc = new DocumentFragment();
templateDesc.createDiv().innerHTML = t("template_new_help") + "<br>" + t("available_variables") + `<br>` +
`<strong>{{title}}</strong> → Title <br>` +
`<strong>{{link}}</strong> → Link to article<br>` +
`<strong>{{author}}</strong> → Author of article<br>` +
`<strong>{{published}}</strong> → Date published<br>` +
`<strong>{{created}}</strong> → Note creation date<br>` +
`<strong>{{description}}</strong> → Short article description<br>` +
`<strong>{{content}}</strong> → article content<br>` +
`<strong>{{folder}}</strong> → Folder of feed<br>` +
`<strong>{{feed}}</strong> → Title of feed<br>` +
`<strong>{{filename}}</strong> → Filename<br>` +
`<strong>{{tags}}</strong> → Tags split by comma<br>` +
`<strong>{{media}}</strong> → Link to video/audio file<br>` +
`<strong>{{highlights}}</strong> → Highlights`;
`<strong>{{title}}</strong> → ${t("article_title")}<br>` +
`<strong>{{link}}</strong> → ${t("article_link")}<br>` +
`<strong>{{author}}</strong> → ${t("article_author")}<br>` +
`<strong>{{published}}</strong> → ${t("article_published")}<br>` +
`<strong>{{created}}</strong> → ${t("note_created")}<br>` +
`<strong>{{description}}</strong> → ${t("article_description")}<br>` +
`<strong>{{content}}</strong> → ${t("article_content")}<br>` +
`<strong>{{folder}}</strong> → ${t("feed_folder")}<br>` +
`<strong>{{feed}}</strong> → ${t("feed_title")}<br>` +
`<strong>{{filename}}</strong> → ${t("filename")}<br>` +
`<strong>{{tags}}</strong> → ${t("article_tags")}<br>` +
`<strong>{{media}}</strong> → ${t("article_media")}<br>` +
`<strong>{{highlights}}</strong> → ${t("highlights")}`;

new Setting(containerEl)
.setName(t("template_new"))
Expand All @@ -69,18 +69,18 @@ export class RSSReaderSettingsTab extends PluginSettingTab {

const pasteTemplateDesc = new DocumentFragment();
pasteTemplateDesc.createDiv().innerHTML = t("template_new_help") + "<br>" + t("available_variables") + `<br>` +
`<strong>{{title}}</strong> → Title <br>` +
`<strong>{{link}}</strong> → Link to article<br>` +
`<strong>{{author}}</strong> → Author of article<br>` +
`<strong>{{published}}</strong> → Date published<br>` +
`<strong>{{created}}</strong> → Note creation date<br>` +
`<strong>{{description}}</strong> → Short article description<br>` +
`<strong>{{content}}</strong> → article content<br>` +
`<strong>{{folder}}</strong> → Folder of feed<br>` +
`<strong>{{feed}}</strong> → Title of feed<br>` +
`<strong>{{tags}}</strong> → Tags split by comma<br>` +
`<strong>{{media}}</strong> → Link to video/audio file<br>` +
`<strong>{{highlights}}</strong> → Highlights`
`<strong>{{title}}</strong> → ${t("article_title")}<br>` +
`<strong>{{link}}</strong> → ${t("article_link")}<br>` +
`<strong>{{author}}</strong> → ${t("article_author")}<br>` +
`<strong>{{published}}</strong> → ${t("article_published")}<br>` +
`<strong>{{created}}</strong> → ${t("note_created")}<br>` +
`<strong>{{description}}</strong> → ${t("article_description")}<br>` +
`<strong>{{content}}</strong> → ${t("article_content")}<br>` +
`<strong>{{folder}}</strong> → ${t("feed_folder")}<br>` +
`<strong>{{feed}}</strong> → ${t("feed_title")}<br>` +
`<strong>{{tags}}</strong> → ${t("article_tags")}<br>` +
`<strong>{{media}}</strong> → ${t("article_media")}<br>` +
`<strong>{{highlights}}</strong> → ${t("highlights")}`;

new Setting(containerEl)
.setName(t("template_paste"))
Expand Down
6 changes: 4 additions & 2 deletions src/view/FolderView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
let level = {result};
filteredContent.forEach(filter => {
filter.filter.name.split('/').reduce((r, name, i, a) => {
filter.filter.name.split('/').reduce((r, name) => {
if (!r[name]) {
r[name] = {result: []};
if (filter.filter.name.endsWith(name)) {
Expand Down Expand Up @@ -122,7 +122,9 @@
<div class="tree-item-children">
<div class="{folded.contains('rss-filters-' + folder.name) ? 'is-collapsed' : ''} tree-item is-clickable"
on:click={() => toggleFold('rss-filters-' + folder.name)}>
<span class="tree-item-self is-clickable">
<span class="tree-item-self is-clickable"
on:contextmenu={(e) => openMenu(e, folder.filter.items.items)}
>
{#if folded.contains('rss-filters-' + folder.name)}
<IconComponent iconName="right-chevron-glyph"/>
{:else}
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"noImplicitAny": true,
"moduleResolution": "node",
"importHelpers": true,
"isolatedModules": true,
"types": [
"node",
"svelte"
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@
"1.0.2": "0.12.17",
"1.0.3": "0.12.17",
"1.0.4": "0.12.17",
"1.0.5": "0.12.17"
"1.0.5": "0.12.17",
"1.1.0": "0.12.17"
}

0 comments on commit 1d1a89b

Please sign in to comment.