Skip to content

Commit

Permalink
add german / move to localization.json
Browse files Browse the repository at this point in the history
  • Loading branch information
qdraw committed Feb 28, 2024
1 parent 666ba6a commit 4969610
Show file tree
Hide file tree
Showing 49 changed files with 836 additions and 404 deletions.
6 changes: 4 additions & 2 deletions documentation/docs/developer-guide/api/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ This document is auto generated
| __/api/delete__ | DELETE| Remove files from the disk, but the file must contain the !delete! (TrashKeyw...|
| _Parameters: f (subPaths, separated by dot comma), collections (true is to update files with the same name before _ |
| _ the extenstion) _ |
| __/api/desktop-editor/open__ | GET | Open a file in the default editor or a specific editor on the desktop |
| _Parameters: f (single or multiple subPaths), collections (to combine files with the same name before the extension) _ |
| __/api/desktop-editor/amount-confirmation__ | GET | Check the amount of files to open before |
| __/api/disk/mkdir__ | POST | Make a directory (-p) |
| __/api/disk/rename__ | POST | Rename file/folder and update it in the database |
| _Parameters: f (from subPath), to (to subPath), collections (is collections bool), currentStatus (default is to not _ |
Expand Down Expand Up @@ -103,7 +106,6 @@ This document is auto generated
| _ json (text as output), extraLarge (give preference to extraLarge over large image) _ |
| __/api/thumbnail/zoom/\{f\}@\{z\}__ | GET | Get zoomed in image by fileHash.At the moment this is the source image |
| __/api/thumbnail-generation__ | POST | Create thumbnails for a folder in the background |
| __/api/trash/detect-to-use-system-trash__ | GET | Is the system trash supported |
| __/api/trash/move-to-trash__ | POST | (beta) Move a file to the trash |
| __/api/trash/move-to-trash__ | POST | Move a file to the trash |
| __/api/upload__ | POST | Upload to specific folder (does not check if already has been imported)Use th...|
| __/api/upload-sidecar__ | POST | Upload sidecar file to specific folder (does not check if already has been im...|
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useState } from "react";
import useGlobalSettings from "../../../hooks/use-global-settings";
import localization from "../../../localization/localization.json";
import { Language } from "../../../shared/language";
import { LimitLength } from "./limit-length";

Expand Down Expand Up @@ -27,11 +28,8 @@ const FormControl: React.FunctionComponent<IFormControlProps> = ({ onBlur, ...pr
// content
const settings = useGlobalSettings();
const language = new Language(settings.language);
const MessageFieldMaxLength = language.token(
language.text(
"Het onderstaande veld mag maximaal {maxlength} tekens hebben",
"The field below can have a maximum of {maxlength} characters"
),
const MessageFieldMaxLength = language.key(
localization.MessageFieldMaxLength,
["{maxlength}"],
[maxlength.toString()]
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { fireEvent, render, screen } from "@testing-library/react";
import { LanguageLocalizationExample } from "../../../interfaces/ILanguageLocalization.ts";
import MenuOptionModal from "./menu-option-modal.tsx";

describe("MenuOption component", () => {
Expand All @@ -7,7 +8,7 @@ describe("MenuOption component", () => {
const setEnableMoreMenuMock = jest.fn();
render(
<MenuOptionModal
localization={{ nl: "Content", en: "Content" }}
localization={LanguageLocalizationExample}
isSet={false}
set={setMock}
testName="test"
Expand All @@ -17,7 +18,7 @@ describe("MenuOption component", () => {
);

expect(screen.getByTestId("test")).toBeTruthy();
expect(screen.getByTestId("test").innerHTML).toBe("Content");
expect(screen.getByTestId("test").innerHTML).toBe(LanguageLocalizationExample.en);
});

it("expect child no localisation field", () => {
Expand All @@ -44,7 +45,7 @@ describe("MenuOption component", () => {
const setEnableMoreMenuMock = jest.fn();
render(
<MenuOptionModal
localization={{ nl: "Nederlands", en: "English" }}
localization={LanguageLocalizationExample}
isSet={false}
set={setMock}
testName="test"
Expand All @@ -64,7 +65,7 @@ describe("MenuOption component", () => {
const setEnableMoreMenuMock = jest.fn();
render(
<MenuOptionModal
localization={{ nl: "Nederlands", en: "English" }}
localization={LanguageLocalizationExample}
isSet={false}
set={setMock}
testName="test"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { memo } from "react";
import useGlobalSettings from "../../../hooks/use-global-settings";
import { ILanguageLocalization } from "../../../interfaces/ILanguageLocalization";
import { Language } from "../../../shared/language";

interface IMenuOptionModalProps {
isReadOnly: boolean;
testName: string;
isSet: boolean;
set: React.Dispatch<React.SetStateAction<boolean>>;
localization?: { nl: string; en: string };
localization?: ILanguageLocalization;
setEnableMoreMenu?: React.Dispatch<React.SetStateAction<boolean>>;
children?: React.ReactNode;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { fireEvent, render, screen } from "@testing-library/react";
import { LanguageLocalizationExample } from "../../../interfaces/ILanguageLocalization";
import MenuOption from "./menu-option";

describe("MenuOption component", () => {
it("expect content", () => {
render(
<MenuOption
localization={{ nl: "Content", en: "Content" }}
localization={LanguageLocalizationExample}
onClickKeydown={() => {}}
testName="test"
isReadOnly={false}
/>
);

expect(screen.getByTestId("test")).toBeTruthy();
expect(screen.getByTestId("test").innerHTML).toBe("Content");
expect(screen.getByTestId("test").innerHTML).toBe(LanguageLocalizationExample.en);
});

it("expect child no localisation field", () => {
Expand All @@ -30,7 +31,7 @@ describe("MenuOption component", () => {
it("renders correctly with default props", () => {
render(
<MenuOption
localization={{ nl: "Dutch", en: "English" }}
localization={LanguageLocalizationExample}
onClickKeydown={() => {}}
testName="test-menu-option"
isReadOnly={false}
Expand All @@ -44,7 +45,7 @@ describe("MenuOption component", () => {
it("renders correctly with custom props", () => {
render(
<MenuOption
localization={{ nl: "Dutch", en: "English" }}
localization={LanguageLocalizationExample}
onClickKeydown={() => {}}
testName="test-menu-option1"
isReadOnly={false}
Expand All @@ -59,7 +60,7 @@ describe("MenuOption component", () => {
render(
<MenuOption
isReadOnly={false}
localization={{ nl: "Dutch", en: "English" }}
localization={LanguageLocalizationExample}
onClickKeydown={onClickKeydownMock}
testName="test-menu-option"
/>
Expand All @@ -74,7 +75,7 @@ describe("MenuOption component", () => {
render(
<MenuOption
isReadOnly={false}
localization={{ nl: "Dutch", en: "English" }}
localization={LanguageLocalizationExample}
onClickKeydown={onClickKeydownMock}
testName="test-menu-option"
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { memo } from "react";
import useGlobalSettings from "../../../hooks/use-global-settings";
import { ILanguageLocalization } from "../../../interfaces/ILanguageLocalization";
import { Language } from "../../../shared/language";

interface IMenuOptionProps {
isReadOnly: boolean;
testName: string;
onClickKeydown: () => void;
localization?: { nl: string; en: string };
localization?: ILanguageLocalization;
children?: React.ReactNode;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect } from "react";
import useGlobalSettings from "../../../hooks/use-global-settings";
import localization from "../../../localization/localization.json";
import { Language } from "../../../shared/language";

type MoreMenuPropTypes = {
Expand All @@ -17,7 +18,7 @@ const MoreMenu: React.FunctionComponent<MoreMenuPropTypes> = ({
}) => {
const settings = useGlobalSettings();
const language = new Language(settings.language);
const MessageMore = language.text("Meer", "More");
const MessageMore = language.key(localization.MessageMore);

const offMoreMenu = () => setEnableMoreMenu(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { memo } from "react";
import useGlobalSettings from "../../../hooks/use-global-settings";
import useLocation from "../../../hooks/use-location/use-location";
import { IRelativeObjects } from "../../../interfaces/IDetailView";
import localization from "../../../localization/localization.json";
import { Language } from "../../../shared/language";
import { UrlQuery } from "../../../shared/url-query";
import Link from "../../atoms/link/link";
Expand All @@ -17,8 +18,8 @@ const ArchivePagination: React.FunctionComponent<IRelativeLink> = memo((props) =
// content
const settings = useGlobalSettings();
const language = new Language(settings.language);
const MessagePrevious = language.text("Vorige", "Previous");
const MessageNext = language.text("Volgende", "Next");
const MessagePrevious = language.key(localization.MessagePrevious);
const MessageNext = language.key(localization.MessageNext);

// used for reading current location
const history = useLocation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import useLocation from "../../../hooks/use-location/use-location";
import { PageType } from "../../../interfaces/IDetailView";
import { IExifStatus } from "../../../interfaces/IExifStatus";
import { ISidebarUpdate } from "../../../interfaces/ISidebarUpdate";
import localization from "../../../localization/localization.json";
import { CastToInterface } from "../../../shared/cast-to-interface";
import FetchPost from "../../../shared/fetch/fetch-post";
import { Keyboard } from "../../../shared/keyboard";
Expand All @@ -20,24 +21,14 @@ import Preloader from "../../atoms/preloader/preloader";

const ArchiveSidebarLabelEditAddOverwrite: React.FunctionComponent = () => {
const settings = useGlobalSettings();
const MessageAddName = new Language(settings.language).text("Toevoegen", "Add to");
const MessageOverwriteName = new Language(settings.language).text("Overschrijven", "Overwrite");
const MessageTitleName = new Language(settings.language).text("Titel", "Title");
const MessageErrorReadOnly = new Language(settings.language).text(
"Eén of meerdere bestanden zijn alleen lezen. " +
"Alleen de bestanden met schrijfrechten zijn geupdate.",
"One or more files are read only. " + "Only the files with write permissions have been updated."
);
const MessageErrorGenericFail = new Language(settings.language).text(
"Er is iets misgegaan met het updaten. Probeer het opnieuw",
"Something went wrong with the update. Please try again"
);

const MessageErrorNotFoundSourceMissing = new Language(settings.language).text(
"Eén of meerdere bestanden zijn al verdwenen. " +
"Alleen de bestanden die wel aanwezig zijn geupdate. Draai een handmatige sync",
"One or more files are already gone. " +
"Only the files that are present are updated. Run a manual sync"
const language = new Language(settings.language);
const MessageAddName = language.key(localization.MessageAddName);
const MessageOverwriteName = language.key(localization.MessageOverwriteName);
const MessageTitleName = language.key(localization.MessageTitleName);
const MessageWriteErrorReadOnly = language.key(localization.MessageWriteErrorReadOnly);
const MessageErrorGenericFail = language.key(localization.MessageErrorGenericFail);
const MessageErrorNotFoundSourceMissingRunSync = language.key(
localization.MessageErrorNotFoundSourceMissingRunSync
);

const history = useLocation();
Expand Down Expand Up @@ -107,9 +98,9 @@ const ArchiveSidebarLabelEditAddOverwrite: React.FunctionComponent = () => {
.then((anyData) => {
const result = new CastToInterface().InfoFileIndexArray(anyData.data);
result.forEach((element) => {
if (element.status === IExifStatus.ReadOnly) setIsError(MessageErrorReadOnly);
if (element.status === IExifStatus.ReadOnly) setIsError(MessageWriteErrorReadOnly);
if (element.status === IExifStatus.NotFoundSourceMissing)
setIsError(MessageErrorNotFoundSourceMissing);
setIsError(MessageErrorNotFoundSourceMissingRunSync);

Check warning on line 103 in starsky/starsky/clientapp/src/components/molecules/archive-sidebar/archive-sidebar-label-edit-add-overwrite.tsx

View check run for this annotation

Codecov / codecov/patch

starsky/starsky/clientapp/src/components/molecules/archive-sidebar/archive-sidebar-label-edit-add-overwrite.tsx#L103

Added line #L103 was not covered by tests
if (element.status === IExifStatus.Ok || element.status === IExifStatus.Deleted) {
dispatch({
type: "update",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import useLocation from "../../../hooks/use-location/use-location";
import { PageType } from "../../../interfaces/IDetailView";
import { IExifStatus } from "../../../interfaces/IExifStatus";
import { ISidebarUpdate } from "../../../interfaces/ISidebarUpdate";
import localization from "../../../localization/localization.json";
import { CastToInterface } from "../../../shared/cast-to-interface";
import FetchPost from "../../../shared/fetch/fetch-post";
import { Language } from "../../../shared/language";
Expand All @@ -19,22 +20,14 @@ import Preloader from "../../atoms/preloader/preloader";
const ArchiveSidebarLabelEditSearchReplace: React.FunctionComponent = () => {
const settings = useGlobalSettings();
const language = new Language(settings.language);
const MessageSearchAndReplaceName = language.text("Zoeken en vervangen", "Search and replace");
const MessageTitleName = language.text("Titel", "Title");
const MessageErrorReadOnly = new Language(settings.language).text(
"Eén of meerdere bestanden zijn alleen lezen. " +
"Alleen de bestanden met schrijfrechten zijn geupdate.",
"One or more files are read only. " + "Only the files with write permissions have been updated."
const MessageSearchAndReplaceNameLong = language.key(
localization.MessageSearchAndReplaceNameLong
);
const MessageErrorNotFoundSourceMissing = new Language(settings.language).text(
"Eén of meerdere bestanden zijn al verdwenen. " +
"Alleen de bestanden die wel aanwezig zijn geupdate. Draai een handmatige sync",
"One or more files are already gone. " +
"Only the files that are present are updated. Run a manual sync"
);
const MessageErrorGenericFail = new Language(settings.language).text(
"Er is iets misgegaan met het updaten. Probeer het opnieuw",
"Something went wrong with the update. Please try again"
const MessageTitleName = language.key(localization.MessageTitleName);
const MessageWriteErrorReadOnly = language.key(localization.MessageWriteErrorReadOnly);
const MessageErrorGenericFail = language.key(localization.MessageErrorGenericFail);
const MessageErrorNotFoundSourceMissingRunSync = language.key(
localization.MessageErrorNotFoundSourceMissingRunSync
);

const history = useLocation();
Expand Down Expand Up @@ -94,9 +87,9 @@ const ArchiveSidebarLabelEditSearchReplace: React.FunctionComponent = () => {
function handleFetchPostResponse(anyData: any) {
const result = new CastToInterface().InfoFileIndexArray(anyData.data);
result.forEach((element) => {
if (element.status === IExifStatus.ReadOnly) setIsError(MessageErrorReadOnly);
if (element.status === IExifStatus.ReadOnly) setIsError(MessageWriteErrorReadOnly);
if (element.status === IExifStatus.NotFoundSourceMissing)
setIsError(MessageErrorNotFoundSourceMissing);
setIsError(MessageErrorNotFoundSourceMissingRunSync);

Check warning on line 92 in starsky/starsky/clientapp/src/components/molecules/archive-sidebar/archive-sidebar-label-edit-search-replace.tsx

View check run for this annotation

Codecov / codecov/patch

starsky/starsky/clientapp/src/components/molecules/archive-sidebar/archive-sidebar-label-edit-search-replace.tsx#L92

Added line #L92 was not covered by tests
if (element.status === IExifStatus.Ok || element.status === IExifStatus.Deleted) {
dispatch({
type: "update",
Expand Down Expand Up @@ -238,11 +231,11 @@ const ArchiveSidebarLabelEditSearchReplace: React.FunctionComponent = () => {
data-test="replace-button"
onClick={() => pushSearchAndReplace()}
>
{MessageSearchAndReplaceName}
{MessageSearchAndReplaceNameLong}
</button>
) : (
<button disabled className="btn btn--default disabled">
{MessageSearchAndReplaceName}
{MessageSearchAndReplaceNameLong}
</button>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useContext, useState } from "react";
import { ArchiveContext } from "../../../contexts/archive-context";
import useGlobalSettings from "../../../hooks/use-global-settings";
import localization from "../../../localization/localization.json";
import { CastToInterface } from "../../../shared/cast-to-interface";
import { Language } from "../../../shared/language";
import SwitchButton from "../../atoms/switch-button/switch-button";
Expand All @@ -10,8 +11,10 @@ import ArchiveSidebarLabelEditSearchReplace from "./archive-sidebar-label-edit-s
const ArchiveSidebarLabelEdit: React.FunctionComponent = () => {
// Content
const settings = useGlobalSettings();
const MessageModifyName = new Language(settings.language).text("Wijzigen", "Modify");
const MessageSearchAndReplaceName = new Language(settings.language).text("Vervangen", "Replace");
const MessageModifyName = new Language(settings.language).key(localization.MessageModifyName);
const MessageSearchAndReplaceName = new Language(settings.language).key(
localization.MessageSearchAndReplaceNameShort
);

// Toggle
const [replaceMode, setReplaceMode] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import useGlobalSettings from "../../../hooks/use-global-settings";
import useLocation from "../../../hooks/use-location/use-location";
import { IArchiveProps } from "../../../interfaces/IArchiveProps";
import { IFileIndexItem } from "../../../interfaces/IFileIndexItem";
import localization from "../../../localization/localization.json";
import { Language } from "../../../shared/language";
import { Select } from "../../../shared/select";
import { URLPath } from "../../../shared/url-path";
Expand All @@ -16,8 +17,8 @@ const ArchiveSidebarSelectionList: React.FunctionComponent<IDetailViewSidebarSel
// content
const settings = useGlobalSettings();
const language = new Language(settings.language);
const MessageNoneSelected = language.text("Niets geselecteerd", "Nothing selected");
const MessageAllName = language.text("Alles", "All");
const MessageNoneSelected = language.key(localization.MessageNoneSelected);
const MessageAllName = language.key(localization.MessageAllName);

const history = useLocation();
const [select, setSelect] = React.useState(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useState } from "react";
import useGlobalSettings from "../../../hooks/use-global-settings";
import useKeyboardEvent from "../../../hooks/use-keyboard/use-keyboard-event";
import localization from "../../../localization/localization.json";
import { Keyboard } from "../../../shared/keyboard";
import { Language } from "../../../shared/language";
import Notification, { NotificationType } from "../../atoms/notification/notification";
Expand All @@ -21,9 +22,8 @@ const ColorClassSelectKeyboard: React.FunctionComponent<IColorClassSelectProps>
setIsDone("");
}, [props.filePath]);

const MessageColorClassIsUpdated = new Language(settings.language).text(
"Colorclass is bijgewerkt",
"Colorclass is updated"
const MessageColorClassIsUpdated = new Language(settings.language).key(
localization.MessageColorClassIsUpdated
);

useKeyboardEvent(/[0-8]/, (event: KeyboardEvent) => {
Expand Down
Loading

0 comments on commit 4969610

Please sign in to comment.