Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: update en locale (#2109)
boojack96939400102e
diff --git a/web/src/components/MemoFilter.tsx b/web/src/components/MemoFilter.tsxindex 6ca8844fe..e3197cea6 100644--- a/web/src/components/MemoFilter.tsx+++ b/web/src/components/MemoFilter.tsx@@ -1,7 +1,6 @@import { useEffect } from "react";import { useLocation } from "react-router-dom";import { getDateString } from "@/helpers/datetime";-import { getTextWithMemoType } from "@/helpers/filter";import { useFilterStore } from "@/store/module";import { useTranslate } from "@/utils/i18n";import Icon from "./Icon";@@ -12,8 +11,8 @@ const MemoFilter = () => {const location = useLocation();const filterStore = useFilterStore();const filter = filterStore.state;- const { tag: tagQuery, duration, type: memoType, text: textQuery, visibility } = filter;- const showFilter = Boolean(tagQuery || (duration && duration.from < duration.to) || memoType || textQuery || visibility);+ const { tag: tagQuery, duration, text: textQuery, visibility } = filter;+ const showFilter = Boolean(tagQuery || (duration && duration.from < duration.to) || textQuery || visibility);useEffect(() => {filterStore.clearFilter();@@ -31,16 +30,6 @@ const MemoFilter = () => {<Icon.Tag className="icon-text" /> {tagQuery}<Icon.X className="w-4 h-auto ml-1 opacity-40" /></div>- <div- className={"filter-item-container " + (memoType ? "" : "!hidden")}- onClick={() => {- filterStore.setMemoTypeFilter(undefined);- }}- >- <Icon.Box className="icon-text" />{" "}- {t(getTextWithMemoType(memoType as MemoSpecType) as Exclude<ReturnType<typeof getTextWithMemoType>, "">)}- <Icon.X className="w-4 h-auto ml-1 opacity-40" />- </div><divclassName={"filter-item-container " + (visibility ? "" : "!hidden")}onClick={() => {diff --git a/web/src/helpers/filter.ts b/web/src/helpers/filter.tsdeleted file mode 100644index 720ad43a4..000000000--- a/web/src/helpers/filter.ts+++ /dev/null@@ -1,219 +0,0 @@-import { LINK_REG, PLAIN_LINK_REG, TAG_REG } from "@/labs/marked/parser";-import { getUnixTimeMillis } from "./datetime";--export const relationConsts = [- { text: "filter.and", value: "AND" },- { text: "filter.or", value: "OR" },-] as const;--export const filterConsts = {- TAG: {- text: "filter.type.tag",- value: "TAG",- operators: [- {- text: "filter.operator.contains",- value: "CONTAIN",- },- {- text: "filter.operator.not-contains",- value: "NOT_CONTAIN",- },- ],- },- TYPE: {- text: "filter.type.type",- value: "TYPE",- operators: [- {- text: "filter.operator.is",- value: "IS",- },- {- text: "filter.operator.is-not",- value: "IS_NOT",- },- ],- values: [- {- text: "filter.value.not-tagged",- value: "NOT_TAGGED",- },- {- text: "filter.value.linked",- value: "LINKED",- },- {- text: "filter.value.has-attachment",- value: "HAS_ATTACHMENT",- },- ],- },- TEXT: {- text: "filter.type.text",- value: "TEXT",- operators: [- {- text: "filter.operator.contains",- value: "CONTAIN",- },- {- text: "filter.operator.not-contains",- value: "NOT_CONTAIN",- },- ],- },- DISPLAY_TIME: {- text: "filter.type.display-time",- value: "DISPLAY_TIME",- operators: [- {- text: "filter.operator.before",- value: "BEFORE",- },- {- text: "filter.operator.after",- value: "AFTER",- },- ],- },- VISIBILITY: {- text: "filter.type.visibility",- value: "VISIBILITY",- operators: [- {- text: "filter.operator.is",- value: "IS",- },- {- text: "filter.operator.is-not",- value: "IS_NOT",- },- ],- values: [- {- text: "memo.visibility.public",- value: "PUBLIC",- },- {- text: "memo.visibility.protected",- value: "PROTECTED",- },- {- text: "memo.visibility.private",- value: "PRIVATE",- },- ],- },-} as const;--export const memoSpecialTypes = filterConsts["TYPE"].values;--export const getTextWithMemoType = (type: string) => {- for (const t of memoSpecialTypes) {- if (t.value === type) {- return t.text;- }- }- return "";-};--export const getDefaultFilter = (): BaseFilter => {- return {- type: "TAG",- value: {- operator: "CONTAIN",- value: "",- },- relation: "AND",- };-};--export const checkShouldShowMemoWithFilters = (memo: Memo, filters: Filter[]) => {- let shouldShow = true;-- for (const f of filters) {- const { relation } = f;- const r = checkShouldShowMemo(memo, f);- if (relation === "OR") {- shouldShow = shouldShow || r;- } else {- shouldShow = shouldShow && r;- }- }-- return shouldShow;-};--export const checkShouldShowMemo = (memo: Memo, filter: Filter) => {- const {- type,- value: { operator, value },- } = filter;-- if (value === "") {- return true;- }-- let shouldShow = true;-- if (type === "TAG") {- let contained = true;- const tagsSet = new Set<string>();- for (const t of Array.from(memo.content.match(new RegExp(TAG_REG, "g")) ?? [])) {- const tag = t.replace(TAG_REG, "$1").trim();- const items = tag.split("/");- let temp = "";- for (const i of items) {- temp += i;- tagsSet.add(temp);- temp += "/";- }- }- if (!tagsSet.has(value)) {- contained = false;- }- if (operator === "NOT_CONTAIN") {- contained = !contained;- }- shouldShow = contained;- } else if (type === "TYPE") {- let matched = false;- if (value === "NOT_TAGGED" && memo.content.match(TAG_REG) === null) {- matched = true;- } else if (value === "LINKED" && (memo.content.match(LINK_REG) !== null || memo.content.match(PLAIN_LINK_REG)) !== null) {- matched = true;- } else if (value === "HAS_ATTACHMENT" && memo.resourceList.length > 0) {- matched = true;- }- if (operator === "IS_NOT") {- matched = !matched;- }- shouldShow = matched;- } else if (type === "TEXT") {- if (value.startsWith("^")) {- const reg = new RegExp(value.slice(1));- shouldShow = operator === "NOT_CONTAIN" ? !reg.test(memo.content) : reg.test(memo.content);- } else {- let contained = memo.content.toLowerCase().includes(value.toLowerCase());- if (operator === "NOT_CONTAIN") {- contained = !contained;- }- shouldShow = contained;- }- } else if (type === "DISPLAY_TIME") {- if (operator === "BEFORE") {- return memo.displayTs < getUnixTimeMillis(value);- } else {- return memo.displayTs >= getUnixTimeMillis(value);- }- } else if (type === "VISIBILITY") {- let matched = memo.visibility === value;- if (operator === "IS_NOT") {- matched = !matched;- }- shouldShow = matched;- }-- return shouldShow;-};diff --git a/web/src/locales/en.json b/web/src/locales/en.jsonindex 501e75bb7..9a48a2164 100644--- a/web/src/locales/en.json+++ b/web/src/locales/en.json@@ -75,7 +75,7 @@"auth": {"signup-as-host": "Sign up as Host","host-tip": "You are registering as the Site Host.",- "not-host-tip": "If you don’t have an account, please contact the site host.",+ "not-host-tip": "If you don't have an account, please contact the site host.","new-password": "New password","repeat-new-password": "Repeat the new password"},@@ -164,7 +164,6 @@"member": "Member","member-list": "Member list","system": "System",- "openai": "OpenAI","storage": "Storage","sso": "SSO","account-section": {@@ -265,11 +264,6 @@"telegram-bot-token": "Telegram Bot Token","telegram-bot-token-description": "Telegram Bot Token or API Proxy like `http.../bot<token>`","telegram-bot-token-placeholder": "Your Telegram Bot token",- "openai-api-key": "OpenAI: API Key",- "openai-api-key-description": "Get API key",- "openai-api-key-placeholder": "Your OpenAI API Key",- "openai-api-host": "OpenAI: API Host",- "openai-api-host-placeholder": "Default: https://api.openai.com/","display-with-updated-time": "Display with updated time"},"appearance-option": {@@ -300,32 +294,6 @@"disabled-password-login-warning": "Password-login is disabled, be extra careful when removing identity providers❗"}},- "filter": {- "new-filter": "New Filter",- "type": {- "tag": "Tag",- "type": "Type",- "text": "Text",- "display-time": "Display Time",- "visibility": "Visibility"- },- "operator": {- "contains": "Contains",- "not-contains": "Does not contain",- "is": "Is",- "is-not": "Is Not",- "before": "Before",- "after": "After"- },- "value": {- "not-tagged": "No tags",- "linked": "Has links",- "has-attachment": "Has attachments"- },- "text-placeholder": "Starts with ^ to use regex",- "and": "And",- "or": "Or"- },"amount-text": {"memo_one": "MEMO","memo_other": "MEMOS",@@ -334,6 +302,36 @@"day_one": "TAG","day_other": "TAGE"},+ "days": {+ "mon": "Mon",+ "tue": "Tue",+ "wed": "Wed",+ "thu": "Thu",+ "fri": "Fri",+ "sat": "Sat",+ "sun": "Sun"+ },+ "embed-memo": {+ "title": "Embed Memo",+ "text": "Copy and paste the below code into your blog or website.",+ "only-public-supported": "* Only public memos can be embedded.",+ "copy": "Copy"+ },+ "heatmap": {+ "memo-in": "memo in {{period}}",+ "memos-in": "memos in {{period}}",+ "memo-on": "{{amount}} memo on {{date}}",+ "memos-on": "{{amount}} memos on {{date}}",+ "day": "day",+ "days": "days"+ },+ "about": {+ "about-memos": "About Memos",+ "memos-description": "Memos is a web-based note-taking application that you can use to write, organize, and share notes.",+ "no-server-description": "No description configured for this server.",+ "powered-by": "Powered by",+ "other-projects": "Other Projects"+ },"message": {"no-data": "Maybe no data was found, or maybe it should be another option.","memos-ready": "all memos are ready 🎉",@@ -380,36 +378,6 @@"maximum-upload-size-is": "Maximum allowed upload size is {{size}} MiB","file-exceeds-upload-limit-of": "File {{file}} exceeds upload limit of {{size}} MiB","updating-setting-failed": "Updating setting failed",- "password-login-disabled": "Can’t remove last identity provider when password login is disabled"- },- "days": {- "mon": "Mon",- "tue": "Tue",- "wed": "Wed",- "thu": "Thu",- "fri": "Fri",- "sat": "Sat",- "sun": "Sun"- },- "embed-memo": {- "title": "Embed Memo",- "text": "Copy and paste the below code into your blog or website.",- "only-public-supported": "* Only public memos can be embedded.",- "copy": "Copy"- },- "heatmap": {- "memo-in": "memo in {{period}}",- "memos-in": "memos in {{period}}",- "memo-on": "{{amount}} memo on {{date}}",- "memos-on": "{{amount}} memos on {{date}}",- "day": "day",- "days": "days"- },- "about": {- "about-memos": "About Memos",- "memos-description": "Memos is a web-based note-taking application that you can use to write, organize, and share notes.",- "no-server-description": "No description configured for this server.",- "powered-by": "Powered by",- "other-projects": "Other Projects"+ "password-login-disabled": "Can't remove last identity provider when password login is disabled"}}