diff --git a/README.md b/README.md index d4cf44aa..6e4f86f4 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # sleek +![image](https://github.com/ransome1/sleek/assets/11188741/304d2da2-e8bd-4901-9d12-04a0f5426317) ### sleek is an open-source (FOSS) todo manager based on the todo.txt syntax. It's available for Windows, macOS and Linux + sleek is an open-source (FOSS) todo manager based on the todo.txt syntax. Stripped down to only the most necessary features, and with a clean and simple interface, sleek aims to help you focus on getting things done. All classic todo.txt attributes are supported and enhanced by additional features. Creating todos is straightforward, and tag-based filtering in tandem with highly customisable grouping and smart full-text search allows for rapid information retrieval. Completed todos can be hidden or archived into separate done.txt files. Easy integration with other todo.txt apps is facilitated by continuously scanning todo.txt files for changes. @@ -10,8 +12,8 @@ sleek is available for Windows, macOS and Linux, and in several languages. [Scre ### ❤️ Sponsor sleek Pushing sleek to the Apple and Microsoft app stores creates annual costs. You can help covering these by [sponsoring the project](https://github.com/sponsors/ransome1). -### 👩🏾‍💻 Become a contributer -We're actively inviting passionate contributors skilled in `React`, `TypeScript`, `Electron`, and `Jest/Playwright` to join our collaborative effort. The `develop` branch reflects the most recent progress. Here you'll find our roadmap: https://github.com/users/ransome1/projects/3. For those interested, [we've updated our contribution guidelines](https://github.com/ransome1/sleek/wiki/Contributing-Guidelines). +### 👩🏾‍💻 This project needs your support +sleek's backlog is becoming increasingly populated, yet our capacity remains limited. If you are skilled in `React`, `TypeScript`, `Electron`, or `Jest/Playwright` you can support this project. Here you'll find our backlog: https://github.com/users/ransome1/projects/3. For those interested, [we've updated our contribution guidelines](https://github.com/ransome1/sleek/wiki/Contributing-Guidelines). The `develop` branch reflects the most recent progress. ### Get sleek from Apple Mac App Store Get sleek from Apple Mac App Store diff --git a/flatpak/com.github.ransome1.sleek.appdata.xml b/flatpak/com.github.ransome1.sleek.appdata.xml index b2d10616..6c7c9faf 100755 --- a/flatpak/com.github.ransome1.sleek.appdata.xml +++ b/flatpak/com.github.ransome1.sleek.appdata.xml @@ -9,7 +9,7 @@ Robin Ahle - + https://github.com/ransome1/sleek https://github.com/ransome1/sleek/issues diff --git a/package.json b/package.json index 0c640081..913a5361 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sleek", - "version": "2.0.12", + "version": "2.0.13-rc.1", "main": "./src/main/main.tsx", "scripts": { "build": "concurrently \"yarn run peggy\" \"yarn run build:main\" \"yarn run build:renderer\"", @@ -147,7 +147,7 @@ "webpack-merge": "^5.9.0" }, "build": { - "buildVersion": "41", + "buildVersion": "42", "asar": true, "asarUnpack": "**\\*.{node,dll}", "files": [ diff --git a/release/app/package.json b/release/app/package.json index 6b09d45a..068a2e65 100644 --- a/release/app/package.json +++ b/release/app/package.json @@ -1,6 +1,6 @@ { "name": "sleek", - "version": "2.0.12", + "version": "2.0.13-rc.1", "description": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)", "synopsis": "todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)", "keywords": [ diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 2a7b3335..1364ee44 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: sleek base: core20 -version: "2.0.12" +version: "2.0.13-rc.1" summary: todo.txt manager for Linux, free and open-source (FOSS) description: | sleek is an open-source (FOSS) todo manager based on the todo.txt syntax. Stripped down to only the most necessary features, and with a clean and simple interface, sleek aims to help you focus on getting things done. diff --git a/src/locales/cs.json b/src/locales/cs.json index 3b90f723..7139db87 100644 --- a/src/locales/cs.json +++ b/src/locales/cs.json @@ -27,6 +27,9 @@ "settings.zoom": "Přiblížení", "settings.disableAnimations": "Vypnout animace", "settings.useHumanFriendlyDates": "Používat lidsky přívětivá data", + "settings.weekStart": "První den týdne", + "settings.0": "Neděle", + "settings.1": "Pondělí", "drawer.tabs.attributes": "Atributy", "drawer.tabs.filters": "Filtry", "drawer.tabs.sorting": "Řazení", diff --git a/src/locales/de.json b/src/locales/de.json index 7a94f729..670b85d9 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -27,6 +27,9 @@ "settings.zoom": "Vergrößerung", "settings.disableAnimations": "Animationen deaktivieren", "settings.useHumanFriendlyDates": "Benutze benutzerfreundliche Datumsangaben", + "settings.weekStart": "Erster Tag der Woche", + "settings.0": "Sonntag", + "settings.1": "Montag", "drawer.tabs.attributes": "Attribute", "drawer.tabs.filters": "Filter", "drawer.tabs.sorting": "Sortierung", diff --git a/src/locales/en-gb.json b/src/locales/en-gb.json deleted file mode 100644 index 07c2cfc6..00000000 --- a/src/locales/en-gb.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "copy": "Copy", - "delete": "Delete", - "cancel": "Cancel", - "openFile": "Open file", - "createFile": "Create file", - "fileTabs.changeLocation": "Change file for archiving", - "fileTabs.revealTodoFile": "Show todo file in file manager", - "fileTabs.revealArchivingFile": "Show archiving file in file manager", - "fileTabs.removeFileHeadline": "Remove file from sleek?", - "fileTabs.removeFileText": "It will not be deleted from your hard drive.", - "fileTabs.removeFileLabel": "Remove", - "settings.headline": "Settings", - "settings.appendCreationDate": "Append creation date when todo is created", - "settings.convertRelativeToAbsoluteDates": "Convert relative dates to absolute dates", - "settings.notificationsAllowed": "Send notifications", - "settings.showFileTabs": "Show file tabs", - "settings.tray": "Minimize to tray instead of quitting application", - "settings.colorTheme": "Theme", - "settings.system": "Follow system", - "settings.light": "Light", - "settings.dark": "Dark", - "settings.language": "Language", - "settings.notificationThreshold": "Notification threshold", - "settings.bulkTodoCreation": "Multi-line text creates separate todos", - "settings.matomo": "Allow Matomo analytics", - "settings.zoom": "Zoom", - "settings.disableAnimations": "Disable animations", - "settings.useHumanFriendlyDates": "Use human friendly dates", - "drawer.tabs.attributes": "Attributes", - "drawer.tabs.filters": "Filters", - "drawer.tabs.sorting": "Sorting", - "drawer.filters.showCompleted": "Completed todos", - "drawer.filters.showHidden": "Hidden todos", - "drawer.filters.thresholdDateInTheFuture": "Threshold date in the future", - "drawer.filters.dueDateInTheFuture": "Due date in the future", - "drawer.attributes.noAttributesAvailable": "No attributes available yet", - "drawer.attributes.today": "today", - "drawer.attributes.tomorrow": "tomorrow", - "drawer.attributes.nextWeek": "next week", - "drawer.attributes.yesterday": "yesterday", - "drawer.attributes.lastWeek": "last week", - "drawer.attributes.thisWeek": "this week", - "drawer.attributes.thisMonth": "this month", - "drawer.attributes.nextMonth": "next month", - "drawer.attributes.overdue": "overdue", - "drawer.attributes.elapsed": "elapsed", - "drawer.sorting.fileSorting": "Order todos as they appear in the file", - "shared.attributeMapping.t": "Threshold date", - "shared.attributeMapping.due": "Due date", - "shared.attributeMapping.projects": "Projects", - "shared.attributeMapping.contexts": "Contexts", - "shared.attributeMapping.priority": "Priority", - "shared.attributeMapping.rec": "Recurrence", - "shared.attributeMapping.pm": "Pomodoros", - "shared.attributeMapping.created": "Creation date", - "shared.attributeMapping.completed": "Completion date", - "splashscreen.noFiles.text": "Drop your todo.txt file here or use the buttons", - "splashscreen.noTodosAvailable.text": "No todos in this file", - "splashscreen.noTodosAvailable.create": "Create a todo", - "splashscreen.noTodosVisible.text": "No results visible.", - "splashscreen.noTodosVisible.reset": "Reset filters and search", - "search.visibleTodos": "Visible todos: ", - "search.addAsTodo": "Add as todo", - "search.filters.create": "Create search filter", - "todoDialog.footer.add": "Add", - "todoDialog.footer.update": "Update", - "todoDialog.footer.cancel": "Cancel", - "todoDialog.snackbar.emptyInput": "Please enter something into the text field", - "todoDialog.priorityPicker.label": "Priority", - "todoDialog.datePicker.t": "Threshold", - "todoDialog.datePicker.due": "Due", - "todoDialog.recurrencePicker.label": "Recurrence", - "todoDialog.recurrencePicker.every": "Every", - "todoDialog.recurrencePicker.day": "day", - "todoDialog.recurrencePicker.businessDay": "business day", - "todoDialog.recurrencePicker.week": "week", - "todoDialog.recurrencePicker.month": "month", - "todoDialog.recurrencePicker.year": "year", - "todoDialog.recurrencePicker.strict": "strict", - "prompt.delete.headline": "Delete todo?", - "prompt.delete.text": "The todo will be permanently removed from the file", - "prompt.archive.headline": "Archive completed todos?", - "prompt.archive.text": "This will move all completed todos to your specified archiving file", - "prompt.archive.button": "Archive", - "prompt.archive.changeFile.headline": "Choose a File for Archiving", - "prompt.archive.changeFile.text": "To archive completed todos, you need to choose an archive file first", - "prompt.searchFilters.delete.body": "Delete search filter" -} diff --git a/src/locales/en.json b/src/locales/en.json index 07c2cfc6..2bee9676 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -27,6 +27,9 @@ "settings.zoom": "Zoom", "settings.disableAnimations": "Disable animations", "settings.useHumanFriendlyDates": "Use human friendly dates", + "settings.weekStart": "First day of the week", + "settings.0": "Sunday", + "settings.1": "Monday", "drawer.tabs.attributes": "Attributes", "drawer.tabs.filters": "Filters", "drawer.tabs.sorting": "Sorting", diff --git a/src/locales/es.json b/src/locales/es.json index 0a57b278..996044d0 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -26,6 +26,10 @@ "settings.matomo": "Permitir análisis de Matomo", "settings.zoom": "Zoom", "settings.disableAnimations": "Desactivar animaciones", + "settings.useHumanFriendlyDates": "Usar fechas amigables para el usuario", + "settings.weekStart": "Primer día de la semana", + "settings.0": "Domingo", + "settings.1": "Lunes", "drawer.tabs.attributes": "Atributos", "drawer.tabs.filters": "Filtros", "drawer.tabs.sorting": "Ordenación", diff --git a/src/locales/fr.json b/src/locales/fr.json index 92f34630..7793d33e 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -27,6 +27,9 @@ "settings.zoom": "Zoom", "settings.disableAnimations": "Désactiver les animations", "settings.useHumanFriendlyDates": "Utiliser des dates conviviales", + "settings.weekStart": "Premier jour de la semaine", + "settings.0": "Dimanche", + "settings.1": "Lundi", "drawer.tabs.attributes": "Attributs", "drawer.tabs.filters": "Filtres", "drawer.tabs.sorting": "Tri", diff --git a/src/locales/hi.json b/src/locales/hi.json index c0be87b9..db1407d9 100644 --- a/src/locales/hi.json +++ b/src/locales/hi.json @@ -27,6 +27,9 @@ "settings.zoom": "ज़ूम", "settings.disableAnimations": "एनिमेशन अक्षम करें", "settings.useHumanFriendlyDates": "मानव-मित्रता योग्य तिथियाँ उपयोग करें", + "settings.weekStart": "सप्ताह का पहला दिन", + "settings.0": "रविवार", + "settings.1": "सोमवार", "drawer.tabs.attributes": "गुण", "drawer.tabs.filters": "फ़िल्टर", "drawer.tabs.sorting": "क्रमबद्ध करना", diff --git a/src/locales/hu.json b/src/locales/hu.json index b911d129..01f08da2 100644 --- a/src/locales/hu.json +++ b/src/locales/hu.json @@ -27,6 +27,9 @@ "settings.zoom": "Nagyítás", "settings.disableAnimations": "Animációk kikapcsolása", "settings.useHumanFriendlyDates": "Használjon emberbarát dátumokat", + "settings.weekStart": "Hét első napja", + "settings.0": "Vasárnap", + "settings.1": "Hétfő", "drawer.tabs.attributes": "Tulajdonságok", "drawer.tabs.filters": "Szűrők", "drawer.tabs.sorting": "Rendezés", diff --git a/src/locales/it.json b/src/locales/it.json index 895ac62e..75cb78fd 100644 --- a/src/locales/it.json +++ b/src/locales/it.json @@ -27,6 +27,9 @@ "settings.zoom": "Zoom", "settings.disableAnimations": "Disattiva animazioni", "settings.useHumanFriendlyDates": "Usa date user-friendly", + "settings.weekStart": "Primo giorno della settimana", + "settings.0": "Domenica", + "settings.1": "Lunedì", "drawer.tabs.attributes": "Attributi", "drawer.tabs.filters": "Filtri", "drawer.tabs.sorting": "Ordinamento", diff --git a/src/locales/jp.json b/src/locales/jp.json index b737726c..164dca75 100644 --- a/src/locales/jp.json +++ b/src/locales/jp.json @@ -27,6 +27,9 @@ "settings.zoom": "ズーム", "settings.disableAnimations": "アニメーションを無効にする", "settings.useHumanFriendlyDates": "使いやすい日付を使用する", + "settings.weekStart": "週の初日", + "settings.0": "日曜日", + "settings.1": "月曜日", "drawer.tabs.attributes": "属性", "drawer.tabs.filters": "フィルター", "drawer.tabs.sorting": "ソート", diff --git a/src/locales/ko.json b/src/locales/ko.json index b6b860b9..45fa5249 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -27,6 +27,9 @@ "settings.zoom": "줌", "settings.disableAnimations": "애니메이션 비활성화", "settings.useHumanFriendlyDates": "사용자 친화적인 날짜 사용", + "settings.weekStart": "주의 첫날", + "settings.0": "일요일", + "settings.1": "월요일", "drawer.tabs.attributes": "속성", "drawer.tabs.filters": "필터", "drawer.tabs.sorting": "정렬", diff --git a/src/locales/pl.json b/src/locales/pl.json index ec4a34b7..13973472 100644 --- a/src/locales/pl.json +++ b/src/locales/pl.json @@ -27,6 +27,9 @@ "settings.zoom": "Powiększenie", "settings.disableAnimations": "Wyłącz animacje", "settings.useHumanFriendlyDates": "Używaj przyjaznych dla użytkownika dat", + "settings.weekStart": "Pierwszy dzień tygodnia", + "settings.0": "Niedziela", + "settings.1": "Poniedziałek", "drawer.tabs.attributes": "Atrybuty", "drawer.tabs.filters": "Filtry", "drawer.tabs.sorting": "Sortowanie", diff --git a/src/locales/pt.json b/src/locales/pt.json index 0532fca9..f2933dbc 100644 --- a/src/locales/pt.json +++ b/src/locales/pt.json @@ -27,6 +27,9 @@ "settings.zoom": "Zoom", "settings.disableAnimations": "Desativar animações", "settings.useHumanFriendlyDates": "Usar datas amigáveis", + "settings.weekStart": "Primeiro dia da semana", + "settings.0": "Domingo", + "settings.1": "Segunda-feira", "drawer.tabs.attributes": "Atributos", "drawer.tabs.filters": "Filtros", "drawer.tabs.sorting": "Ordenação", diff --git a/src/locales/ru.json b/src/locales/ru.json index a5f7997b..6b01c0b5 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -27,6 +27,9 @@ "settings.zoom": "Масштаб", "settings.disableAnimations": "Отключить анимации", "settings.useHumanFriendlyDates": "Использовать удобочитаемые даты", + "settings.weekStart": "Первый день недели", + "settings.0": "Воскресенье", + "settings.1": "Понедельник", "drawer.tabs.attributes": "Атрибуты", "drawer.tabs.filters": "Фильтры", "drawer.tabs.sorting": "Сортировка", diff --git a/src/locales/tr.json b/src/locales/tr.json index 5bf3afa3..5b0add70 100644 --- a/src/locales/tr.json +++ b/src/locales/tr.json @@ -27,6 +27,9 @@ "settings.zoom": "Yakınlaştırma", "settings.disableAnimations": "Animasyonları devre dışı bırak", "settings.useHumanFriendlyDates": "İnsan dostu tarihleri kullan", + "settings.weekStart": "Haftanın ilk günü", + "settings.0": "Pazar", + "settings.1": "Pazartesi", "drawer.tabs.attributes": "Özellikler", "drawer.tabs.filters": "Filtreler", "drawer.tabs.sorting": "Sıralama", diff --git a/src/locales/zh.json b/src/locales/zh.json index 8e418610..e0e9af34 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -27,6 +27,9 @@ "settings.zoom": "缩放", "settings.disableAnimations": "禁用动画", "settings.useHumanFriendlyDates": "使用人性化日期", + "settings.weekStart": "一周的第一天", + "settings.0": "星期日", + "settings.1": "星期一", "drawer.tabs.attributes": "属性", "drawer.tabs.filters": "过滤器", "drawer.tabs.sorting": "排序", diff --git a/src/main/config.tsx b/src/main/config.tsx index aca5ca42..27f793fd 100644 --- a/src/main/config.tsx +++ b/src/main/config.tsx @@ -104,6 +104,10 @@ const config: Store = new Store({ store.set('fileWatcherPolling', false); store.set('fileWatcherPollingInterval', 100); }, + '2.0.13': store => { + console.log('Migrating from 2.0.12 → 2.0.13'); + store.set('weekStart', 1); + }, } }); diff --git a/src/main/modules/ProcessDataRequest/ProcessTodoObjects.tsx b/src/main/modules/ProcessDataRequest/ProcessTodoObjects.tsx index 1606ae8e..53cf9800 100644 --- a/src/main/modules/ProcessDataRequest/ProcessTodoObjects.tsx +++ b/src/main/modules/ProcessDataRequest/ProcessTodoObjects.tsx @@ -56,9 +56,10 @@ function handleCompletedTodoObjects(todoObjects: TodoObject[]): TodoObject[] { const showCompleted: boolean = config.get('showCompleted'); return todoObjects.map((todoObject: TodoObject) => { if(todoObject.complete && !showCompleted) { - todoObject.visible = false; + return false; + } else { + return todoObject; } - return todoObject; }); } @@ -74,20 +75,14 @@ function handleTodoObjectsDates(todoObjects: TodoObject[]): TodoObject[] { const thresholdDateInTheFuture: boolean = config.get('thresholdDateInTheFuture'); const dueDateInTheFuture: boolean = config.get('dueDateInTheFuture'); - return todoObjects.map((todoObject: TodoObject) => { + return todoObjects.filter((todoObject: TodoObject) => { + if (!todoObject.visible) return true; - if(!todoObject.visible) return todoObject; - const thresholdDate = dayjs(todoObject?.t); const dueDate = dayjs(todoObject?.due); - if(thresholdDate && thresholdDate.isAfter(dayjs()) && !thresholdDateInTheFuture) { - todoObject.visible = false; - } else if(dueDate && dueDate.isAfter(dayjs()) && !dueDateInTheFuture) { - todoObject.visible = false; - } - - return todoObject; + return !(thresholdDate && thresholdDate.isAfter(dayjs()) && !thresholdDateInTheFuture) && + !(dueDate && dueDate.isAfter(dayjs()) && !dueDateInTheFuture); }); } diff --git a/src/renderer/Drawer/Attributes.tsx b/src/renderer/Drawer/Attributes.tsx index 0e008da0..bb11b18f 100644 --- a/src/renderer/Drawer/Attributes.tsx +++ b/src/renderer/Drawer/Attributes.tsx @@ -43,7 +43,7 @@ const DrawerAttributes: React.FC = memo(({ Object.keys(attributes).forEach((key) => { if (attributes[key]) { const count = attributes[key].count; - const formattedValues = settings.useHumanFriendlyDates && isDate ? friendlyDate(key, attributeKey, settings.language, t) : [key]; + const formattedValues = settings.useHumanFriendlyDates && isDate ? friendlyDate(key, attributeKey, settings, t) : [key]; formattedValues.forEach((formattedValue) => { if (!processedAttributes[formattedValue]) { diff --git a/src/renderer/Grid/DatePickerInline.tsx b/src/renderer/Grid/DatePickerInline.tsx index 25bc29be..947bf4f6 100644 --- a/src/renderer/Grid/DatePickerInline.tsx +++ b/src/renderer/Grid/DatePickerInline.tsx @@ -8,6 +8,8 @@ import { handleFilterSelect, friendlyDate } from '../Shared'; import { withTranslation } from 'react-i18next'; import { i18n } from '../Settings/LanguageSelector'; import dayjs from 'dayjs'; +import updateLocale from 'dayjs/plugin/updateLocale'; +dayjs.extend(updateLocale); const { ipcRenderer } = window.api; @@ -31,6 +33,10 @@ const DatePickerInline: React.FC = ({ const [open, setOpen] = useState(false); const chipText = type === 'due' ? "due:" : type === 't' ? "t:" : null; + dayjs.updateLocale(settings.language, { + weekStart: settings.weekStart, + }); + const handleChange = (date: dayjs.Dayjs | null) => { try { ipcRenderer.send('writeTodoToFile', todoObject.id, todoObject.string, false, type, dayjs(date).format('YYYY-MM-DD')); @@ -55,7 +61,7 @@ const DatePickerInline: React.FC = ({ const ButtonField = ({ ...props }) => { const { disabled, InputProps: { ref } = {}, inputProps: { 'aria-label': ariaLabel } = {} } = props; const mustNotify = (type === 'due') ? !todoObject?.notify : true; - const formattedValue = settings.useHumanFriendlyDates && dayjs(date).isValid() ? friendlyDate(date, type, settings.language, t).pop() : date; + const formattedValue = settings.useHumanFriendlyDates && dayjs(date).isValid() ? friendlyDate(date, type, settings, t).pop() : date; const selected = filters && type !== null && (filters[type as keyof Filters] || []).some((filter: Filter) => { return filter.values.includes(date); diff --git a/src/renderer/Header/Search/Input.scss b/src/renderer/Header/Search/Input.scss index 2451a2dc..039e09fe 100644 --- a/src/renderer/Header/Search/Input.scss +++ b/src/renderer/Header/Search/Input.scss @@ -6,6 +6,9 @@ } .MuiButtonBase-root { border: none; + svg { + color: $blue; + } svg.invert { transform: rotate(180deg); } diff --git a/src/renderer/Settings/LanguageSelector.tsx b/src/renderer/Settings/LanguageSelector.tsx index 15ee3373..aaedd891 100644 --- a/src/renderer/Settings/LanguageSelector.tsx +++ b/src/renderer/Settings/LanguageSelector.tsx @@ -7,7 +7,6 @@ import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import de from '../../locales/de.json'; import en from '../../locales/en.json'; -import en_GB from '../../locales/en-gb.json'; import it from '../../locales/it.json'; import es from '../../locales/es.json'; import fr from '../../locales/fr.json'; @@ -23,7 +22,6 @@ import ko from '../../locales/ko.json'; import hi from '../../locales/hi.json'; import 'dayjs/locale/de'; import 'dayjs/locale/en'; -import 'dayjs/locale/en-gb'; import 'dayjs/locale/it'; import 'dayjs/locale/es'; import 'dayjs/locale/fr'; @@ -41,7 +39,6 @@ const options: i18n.InitOptions = { resources: { de: { translation: de }, en: { translation: en }, - 'en-gb': { translation: en_GB }, it: { translation: it }, es: { translation: es }, fr: { translation: fr }, @@ -57,7 +54,7 @@ const options: i18n.InitOptions = { hi: { translation: hi }, }, fallbackLng: 'en', - supportedLngs: ['de', 'en', 'en-gb', 'it', 'es', 'fr', 'zh', 'pt', 'jp', 'tr', 'hu', 'cs', 'pl', 'ru', 'ko', 'hi'], + supportedLngs: ['de', 'en', 'it', 'es', 'fr', 'zh', 'pt', 'jp', 'tr', 'hu', 'cs', 'pl', 'ru', 'ko', 'hi'], interpolation: { escapeValue: false, }, @@ -82,7 +79,6 @@ i18n const friendlyLanguageName: Record = { de: 'Deutsch', en: 'English', - 'en-gb': 'English (UK)', it: 'Italiano', es: 'Español', fr: 'Français', diff --git a/src/renderer/Settings/Settings.tsx b/src/renderer/Settings/Settings.tsx index ce1c39a2..9987b1f5 100644 --- a/src/renderer/Settings/Settings.tsx +++ b/src/renderer/Settings/Settings.tsx @@ -40,6 +40,7 @@ const visibleSettings: VisibleSettings = { }, useHumanFriendlyDates: { style: 'toggle', + help: 'https://github.com/ransome1/sleek/wiki/Human-friendly-dates', }, notificationsAllowed: { style: 'toggle', @@ -63,6 +64,10 @@ const visibleSettings: VisibleSettings = { style: 'select', values: ['system', 'light', 'dark'], }, + weekStart: { + style: 'select', + values: [1, 0], + }, }; diff --git a/src/renderer/Shared.tsx b/src/renderer/Shared.tsx index b3f3ad44..738f8376 100644 --- a/src/renderer/Shared.tsx +++ b/src/renderer/Shared.tsx @@ -3,10 +3,12 @@ import relativeTime from 'dayjs/plugin/relativeTime'; import duration from 'dayjs/plugin/duration'; import calendar from 'dayjs/plugin/calendar'; import weekday from 'dayjs/plugin/weekday'; +import updateLocale from 'dayjs/plugin/updateLocale'; dayjs.extend(relativeTime); dayjs.extend(duration); dayjs.extend(calendar); dayjs.extend(weekday); +dayjs.extend(updateLocale); const { store, ipcRenderer } = window.api; @@ -60,9 +62,10 @@ export const translatedAttributes = (t: typeof i18n.t) => { } }; -export const friendlyDate = (value: string, attributeKey: string, language: string, t: typeof i18n.t) => { - - dayjs.locale(language) +export const friendlyDate = (value: string, attributeKey: string, settings: Settings, t: typeof i18n.t) => { + dayjs.updateLocale(settings.language, { + weekStart: settings.weekStart, + }); const today = dayjs(); const date = dayjs(value); diff --git a/yarn.lock b/yarn.lock index ee05315d..4a3b0803 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2055,9 +2055,9 @@ integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA== "@tsconfig/node10@^1.0.7": - version "1.0.9" - resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" - integrity sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA== + version "1.0.10" + resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.10.tgz#b7ebd3adfa7750628d100594f6726b054d2c33b2" + integrity sha512-PiaIWIoPvO6qm6t114ropMCagj6YAF24j9OkCA2mJDXFnlionEwhsBCJ8yek4aib575BI3OkART/90WsgHgLWw== "@tsconfig/node12@^1.0.7": version "1.0.11"