Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion development.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ To set up the project locally for development and testing, please follow these s
```
- **constants** - all constants that are globally used and should not change during usage of app, e.g.: height and width of cell, width of single tile.
- **context** - folder that consists CalendarProvider and LocaleProvider
- **locales** - folder that consists files with translations (currently en / pl / de)
- **locales** - folder that consists files with translations (currently en / pl / de / lt)
- **types** - folder that consists all global types and type guards
- **utils** - folder that consists all utility functions used within app (e.g. drawing all the grid, data parsers etc.)

Expand Down
3 changes: 2 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const mockedSchedulerData: SchedulerData = [
| zoom | `0` or `1` | 0 | `0` - display grid divided into weeks `1` - display grid divided into days |
| filterButtonState | `number` | 0 | `< 0` - hides filter button, `0` - state for when filters were not set, `> 0` - state for when some filters were set (allows to also handle `onClearFilterData` event) |
| maxRecordsPerPage | `number` | 50 | number of items from `SchedulerData` visible per page |
| lang | `en` or `pl` | en | scheduler's language |
| lang | `en`, `lt` or `pl` | en | scheduler's language |
| includeTakenHoursOnWeekendsInDayView | `boolean` | `false` | show weekends as taken when given resource is longer than a week |
| showTooltip | `boolean` | `true` | show tooltip when hovering over tiles |
| translations | `LocaleType[]` | `undefined` | option to add specific langs translations |
Expand Down Expand Up @@ -245,6 +245,7 @@ const langs: LocaleType[] = [
| today | `string` |
| view | `string` |


##### Scheduler Data

array of chart rows with shape of
Expand Down
2 changes: 2 additions & 0 deletions src/context/LocaleProvider/LocaleProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ const LocaleProvider = ({ children, lang, translations }: LocaleProviderProps) =
return l.id === localLang;
});


if (typeof locale?.dayjsTranslations === "object") {
dayjs.locale(locale.dayjsTranslations);
}

return locale || localesData[0];

}, [localLang]);

const [currentLocale, setCurrentLocale] = useState<LocaleType>(findLocale());
Expand Down
12 changes: 10 additions & 2 deletions src/context/LocaleProvider/locales.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

import enDayjsTranslations from "dayjs/locale/en";
import plDayjsTranslations from "dayjs/locale/pl";
import deDayjsTranslations from "dayjs/locale/de";
import { en, pl, de } from "@/locales";
import ltDayjsTranslations from "dayjs/locale/lt";
import { en, pl, de, lt } from "@/locales";
import { LocaleType } from "./types";

export const localesData: LocaleType[] = [
Expand All @@ -14,9 +16,15 @@ export const localesData: LocaleType[] = [
{
id: "pl",
lang: pl,
translateCode: "pl-PL",
translateCode: "pl-PL"
dayjsTranslations: plDayjsTranslations
},
{
id: "lt",
lang: lt,
translateCode: "lt-LT"
dayjsTranslations: ltDayjsTranslations
},
{
id: "de",
lang: de,
Expand Down
17 changes: 17 additions & 0 deletions src/locales/lt.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export const lt = {
feelingEmpty: "Jaučiuosi toks tuščias...",
free: "Laisva",
loadNext: "Kitas",
loadPrevious: "Ankstesnis",
over: "virš",
taken: "Užimta",
topbar: {
filters: "Filtras",
next: "kitas",
prev: "ankstesnis",
today: "Šiandien",
view: "Rodinys"
},
search: "ieškoti",
week: "savaitė"
};
4 changes: 3 additions & 1 deletion src/types/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export type FilterButtonState = -1 | 0 | 1;
type ZoomLevelTuple = typeof allZoomLevel;

export type ZoomLevel = ZoomLevelTuple[number];
export type LangCodes = "en" | "pl" | "de";

export type LangCodes = "en" | "pl" | "de" | "lt";

export type Config = {
zoom: ZoomLevel;
/**
Expand Down