Skip to content

Commit

Permalink
Add "First day of the week" option
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmeuli committed Feb 9, 2020
1 parent d57ec72 commit 6f68086
Show file tree
Hide file tree
Showing 22 changed files with 278 additions and 28 deletions.
12 changes: 11 additions & 1 deletion src/main/i18n/translations/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ const translationsDe: Translations = {
"statistics": "Statistiken",
"website": "Website",

// Weekdays
"sunday": "Sonntag",
"monday": "Montag",
"tuesday": "Dienstag",
"wednesday": "Mittwoch",
"thursday": "Donnerstag",
"friday": "Freitag",
"saturday": "Samstag",

// Theme
"auto": "Automatisch",
"dark": "Dunkel",
"light": "Hell",
"theme": "Design",
Expand All @@ -70,7 +78,9 @@ const translationsDe: Translations = {

// Preferences
"allow-future-entries": "Einträge in der Zukunft erlauben",
"auto": "Automatisch",
"diary-entries": "Tagebucheinträge",
"first-day-of-week": "Erster Wochentag",
"no": "Nein",
"ok": "OK",
"reset-diary": "Tagebuch zurücksetzen",
Expand Down
14 changes: 12 additions & 2 deletions src/main/i18n/translations/el.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ const translationsEl: Partial<Translations> = {
"privacy-policy": "Πολιτική Απορρήτου",
"website": "Ιστοσελίδα",

// Weekdays
"sunday": "Κυριακή",
"monday": "Δευτέρα",
"tuesday": "Τρίτη",
"wednesday": "Τετάρτη",
"thursday": "Πέμπτη",
"friday": "Παρασκευή",
"saturday": "Σάββατο",

// Theme
"auto": "Αυτόματο",
"dark": "Σκοτεινό",
"light": "Φωτεινό",
"theme": "Θέμα",
Expand All @@ -66,8 +74,10 @@ const translationsEl: Partial<Translations> = {
"search": "Αναζήτηση",

// Preferences
"diary-entries": "Εγγραφές ημερολογίου",
"allow-future-entries": "Να επιτρέπεται η δημιουργία καταχωρήσεων στο μέλλον",
"auto": "Αυτόματο",
"diary-entries": "Εγγραφές ημερολογίου",
"first-day-of-week": "πρώτη ημέρα της εβδομάδας",

// Password and directory
"change-directory": "Αλλαγή τοποθεσίας",
Expand Down
12 changes: 11 additions & 1 deletion src/main/i18n/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ const translationsEn: Translations = {
"statistics": "Statistics",
"website": "Website",

// Weekdays
"sunday": "Sunday",
"monday": "Monday",
"tuesday": "Tuesday",
"wednesday": "Wednesday",
"thursday": "Thursday",
"friday": "Friday",
"saturday": "Saturday",

// Theme
"auto": "Auto",
"dark": "Dark",
"light": "Light",
"theme": "Theme",
Expand All @@ -70,7 +78,9 @@ const translationsEn: Translations = {

// Preferences
"allow-future-entries": "Allow entries in the future",
"auto": "Auto",
"diary-entries": "Diary entries",
"first-day-of-week": "First day of the week",
"no": "No",
"ok": "OK",
"reset-diary": "Reset diary",
Expand Down
14 changes: 12 additions & 2 deletions src/main/i18n/translations/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ const translationsEs: Partial<Translations> = {
"privacy-policy": "Política de privacidad",
"website": "Página web",

// Weekdays
"sunday": "Domingo",
"monday": "Lunes",
"tuesday": "Martes",
"wednesday": "Miércoles",
"thursday": "Jueves",
"friday": "Viernes",
"saturday": "Sábado",

// Theme
"auto": "Automático",
"dark": "Oscuro",
"light": "Claro",
"theme": "Tema",
Expand All @@ -66,8 +74,10 @@ const translationsEs: Partial<Translations> = {
"search": "Buscar",

// Preferences
"diary-entries": "Entradas del diario",
"allow-future-entries": "Permitir la creación de entradas en el futuro",
"auto": "Automático",
"diary-entries": "Entradas del diario",
"first-day-of-week": "Primer día de la semana",

// Password and directory
"change-directory": "Cambiar carpeta",
Expand Down
14 changes: 12 additions & 2 deletions src/main/i18n/translations/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ const translationsFr: Partial<Translations> = {
"privacy-policy": "Politique de confidentialité",
"website": "Site web",

// Weekdays
"sunday": "Dimanche",
"monday": "Lundi",
"tuesday": "Mardi",
"wednesday": "Mercredi",
"thursday": "Jeudi",
"friday": "Vendredi",
"saturday": "Samedi",

// Theme
"auto": "Automatique",
"dark": "Sombre",
"light": "Clair",
"theme": "Thème",
Expand All @@ -66,8 +74,10 @@ const translationsFr: Partial<Translations> = {
"search": "Rechercher",

// Preferences
"diary-entries": "Entrées de journal",
"allow-future-entries": "Autoriser la création d'entrées à l'avenir",
"auto": "Automatique",
"diary-entries": "Entrées de journal",
"first-day-of-week": "Premier jour de la semaine",

// Password and directory
"change-directory": "Changer de répertoire",
Expand Down
14 changes: 12 additions & 2 deletions src/main/i18n/translations/is.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ const translationsIs: Partial<Translations> = {
"privacy-policy": "Friðhelgistefna",
"website": "Vefsíða",

// Weekdays
"sunday": "Sunnudag",
"monday": "Mánudagur",
"tuesday": "Þriðjudag",
"wednesday": "Miðvikudag",
"thursday": "Fimmtudag",
"friday": "Föstudag",
"saturday": "Laugardag",

// Theme
"auto": "Sjálfgefið",
"dark": "Dökkt",
"light": "Ljóst",
"theme": "Þema",
Expand All @@ -66,8 +74,10 @@ const translationsIs: Partial<Translations> = {
"search": "Leita",

// Preferences
"diary-entries": "Dagbókarfærslur",
"allow-future-entries": "Leyfa að búa til færslur í framtíðinni",
"auto": "Sjálfgefið",
"diary-entries": "Dagbókarfærslur",
"first-day-of-week": "Fyrsta dag vikunnar",

// Password and directory
"change-directory": "Breyta möppu",
Expand Down
14 changes: 12 additions & 2 deletions src/main/i18n/translations/pt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ const translationsPt: Partial<Translations> = {
"privacy-policy": "Política de privacidade",
"website": "Site",

// Weekdays
"sunday": "Domingo",
"monday": "Segunda-feira",
"tuesday": "Terça",
"wednesday": "Quarta-feira",
"thursday": "Quinta-feira",
"friday": "Sexta-feira",
"saturday": "Sábado",

// Theme
"auto": "Automático",
"dark": "Escuro",
"light": "Claro",
"theme": "Tema",
Expand All @@ -66,8 +74,10 @@ const translationsPt: Partial<Translations> = {
"search": "Buscar",

// Preferences
"diary-entries": "Entradas diárias",
"allow-future-entries": "Permitir a criação de entradas no futuro",
"auto": "Automático",
"diary-entries": "Entradas diárias",
"first-day-of-week": "Primeiro dia da semana",

// Password and directory
"change-directory": "Alterar diretório",
Expand Down
14 changes: 12 additions & 2 deletions src/main/i18n/translations/tr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ const translationsTr: Partial<Translations> = {
"privacy-policy": "Gizlilik Politikası",
"website": "Web Sitesi",

// Weekdays
"sunday": "Pazar",
"monday": "Pazartesi",
"tuesday": "Salı",
"wednesday": "Çarşamba",
"thursday": "Perşembe",
"friday": "Cuma",
"saturday": "Cumartesi",

// Theme
"auto": "Otomatik",
"dark": "Karanlık",
"light": "Aydınlık",
"theme": "Tema",
Expand All @@ -66,8 +74,10 @@ const translationsTr: Partial<Translations> = {
"search": "Arama",

// Preferences
"diary-entries": "Günlük girişleri",
"allow-future-entries": "Gelecekte giriş oluşturmaya izin ver",
"auto": "Otomatik",
"diary-entries": "Günlük girişleri",
"first-day-of-week": "Haftanın ilk günü",

// Password and directory
"change-directory": "Klasörü değiştir",
Expand Down
12 changes: 11 additions & 1 deletion src/main/i18n/translations/uk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,16 @@ const translationsUk: Partial<Translations> = {
"statistics": "Статистика",
"website": "Веб-сайт",

// Weekdays
"sunday": "Неділя",
"monday": "Понеділок",
"tuesday": "Вівторок",
"wednesday": "Середа",
"thursday": "Четвер",
"friday": "П’ятниця",
"saturday": "Субота",

// Theme
"auto": "Автоматично",
"dark": "Темна",
"light": "Світла",
"theme": "Тема",
Expand All @@ -68,7 +76,9 @@ const translationsUk: Partial<Translations> = {

// Preferences
"allow-future-entries": "Дозволити записи в майбутньому часі",
"auto": "Автоматично",
"diary-entries": "Записи в щоденнику",
"first-day-of-week": "Перший день тижня",
"no": "Ні",
"reset-diary": "Скинути щоденник",
"reset-diary-confirm": "Так, скинути",
Expand Down
14 changes: 12 additions & 2 deletions src/main/i18n/translations/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,16 @@ const translationsZh: Partial<Translations> = {
"privacy-policy": "隐私条款",
"website": "官网",

// Weekdays
"sunday": "星期日",
"monday": "星期一",
"tuesday": "星期二",
"wednesday": "星期三",
"thursday": "星期四",
"friday": "星期五",
"saturday": "星期六",

// Theme
"auto": "自动",
"dark": "深色",
"light": "浅色",
"theme": "主题",
Expand All @@ -66,8 +74,10 @@ const translationsZh: Partial<Translations> = {
"search": "查找",

// Preferences
"diary-entries": "日记条目",
"allow-future-entries": "允许创建将来的条目",
"auto": "自动",
"diary-entries": "日记条目",
"first-day-of-week": "一周的第一天",

// Password and directory
"change-directory": "更改路径",
Expand Down
12 changes: 11 additions & 1 deletion src/main/i18n/translations/zhTw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,16 @@ const translationsZhTw: Partial<Translations> = {
"statistics": "統計數據",
"website": "官方網站",

// Weekdays
"sunday": "星期日",
"monday": "星期一",
"tuesday": "星期二",
"wednesday": "星期三",
"thursday": "星期四",
"friday": "星期五",
"saturday": "星期六",

// Theme
"auto": "自動",
"dark": "深色",
"light": "淺色",
"theme": "主題",
Expand All @@ -68,7 +76,9 @@ const translationsZhTw: Partial<Translations> = {

// Preferences
"allow-future-entries": "允許新增未來的條目",
"auto": "自動",
"diary-entries": "日記條目",
"first-day-of-week": "一周的第一天",
"no": "取消",
"reset-diary": "重置日記本",
"reset-diary-confirm": "好,我確定",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export interface StateProps {
allowFutureEntries: boolean;
dateSelected: Date;
entries: Entries;
firstDayOfWeek: Weekday | null;
monthSelected: Date;
}

Expand All @@ -37,7 +38,7 @@ export default class Calendar extends PureComponent<Props, {}> {
}

render(): ReactNode {
const { allowFutureEntries, dateSelected, entries, monthSelected } = this.props;
const { allowFutureEntries, dateSelected, entries, firstDayOfWeek, monthSelected } = this.props;

const today = new Date();
const daysWithEntries = Object.keys(entries);
Expand All @@ -54,6 +55,7 @@ export default class Calendar extends PureComponent<Props, {}> {
toMonth={today}
captionElement={(): null => null}
modifiers={{ hasEntry }}
firstDayOfWeek={firstDayOfWeek ?? undefined}
locale={lang}
localeUtils={MomentLocaleUtils}
navbarElement={<CalendarNavContainer />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Calendar, { DispatchProps, StateProps } from "./Calendar";
const mapStateToProps = (state: RootState): StateProps => ({
allowFutureEntries: state.app.allowFutureEntries,
dateSelected: state.diary.dateSelected,
firstDayOfWeek: state.app.firstDayOfWeek,
monthSelected: state.diary.monthSelected,
entries: state.file.entries,
});
Expand Down
8 changes: 4 additions & 4 deletions src/renderer/components/overlays/pref-overlay/PrefOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { ReactElement } from "react";
import { translations } from "../../../utils/i18n";
import OverlayContainer from "../overlay-hoc/OverlayContainer";
import FileDirPrefContainer from "./file-dir-pref/FileDirPrefContainer";
import FirstDayOfWeekPrefContainer from "./first-day-of-week-pref/FirstDayOfWeekPrefContainer";
import FutureEntriesPrefContainer from "./future-entries-pref/FutureEntriesPrefContainer";
import PasswordPrefContainer from "./password-pref/PasswordPrefContainer";
import ThemePrefContainer from "./theme-pref/ThemePrefContainer";
Expand All @@ -26,11 +27,10 @@ export default function PrefOverlay(props: Props): ReactElement {
<h1>{translations.preferences}</h1>
<form className="preferences-form">
<ThemePrefContainer />
{// Future diary entries (only when unlocked)
!isLocked && <FutureEntriesPrefContainer />}
{!isLocked && <FirstDayOfWeekPrefContainer />}
{!isLocked && <FutureEntriesPrefContainer />}
<FileDirPrefContainer />
{// Password (only when unlocked)
!isLocked && <PasswordPrefContainer />}
{!isLocked && <PasswordPrefContainer />}
</form>
</OverlayContainer>
);
Expand Down
Loading

0 comments on commit 6f68086

Please sign in to comment.