Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tame those translations - throw an error if a text string isn't defined with description #785

Merged
merged 11 commits into from
Dec 20, 2023
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
29 changes: 2 additions & 27 deletions src/apps/advanced-search/AdvancedSearch.dev.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ComponentMeta, ComponentStory } from "@storybook/react";
import React from "react";
import serviceUrlArgs from "../../core/storybook/serviceUrlArgs";
import globalTextArgs from "../../core/storybook/globalTextArgs";
import AdvancedSearchEntry, {
AdvancedSearchEntryProps
} from "./AdvancedSearch.entry";
Expand All @@ -10,6 +11,7 @@ export default {
component: AdvancedSearchEntry,
argTypes: {
...serviceUrlArgs,
...globalTextArgs,
pageSizeDesktop: {
name: "Number of search result items on desktop",
defaultValue: 50,
Expand Down Expand Up @@ -96,28 +98,6 @@ export default {
'[\n {\n "branchId":"DK-775120",\n "title":"Højbjerg"\n },\n {\n "branchId":"DK-775122",\n "title":"Beder-Malling"\n },\n {\n "branchId":"DK-775144",\n "title":"Gellerup"\n },\n {\n "branchId":"DK-775167",\n "title":"Lystrup"\n },\n {\n "branchId":"DK-775146",\n "title":"Harlev"\n },\n {\n "branchId":"DK-775168",\n "title":"Skødstrup"\n },\n {\n "branchId":"FBS-751010",\n "title":"Arresten"\n },\n {\n "branchId":"DK-775147",\n "title":"Hasle"\n },\n {\n "branchId":"FBS-751032",\n "title":"Må ikke benyttes"\n },\n {\n "branchId":"FBS-751031",\n "title":"Fjernlager 1"\n },\n {\n "branchId":"DK-775126",\n "title":"Solbjerg"\n },\n {\n "branchId":"FBS-751030",\n "title":"ITK"\n },\n {\n "branchId":"DK-775149",\n "title":"Sabro"\n },\n {\n "branchId":"DK-775127",\n "title":"Tranbjerg"\n },\n {\n "branchId":"DK-775160",\n "title":"Risskov"\n },\n {\n "branchId":"DK-775162",\n "title":"Hjortshøj"\n },\n {\n "branchId":"DK-775140",\n "title":"Åby"\n },\n {\n "branchId":"FBS-751009",\n "title":"Fjernlager 2"\n },\n {\n "branchId":"FBS-751029",\n "title":"Stadsarkivet"\n },\n {\n "branchId":"FBS-751027",\n "title":"Intern"\n },\n {\n "branchId":"FBS-751026",\n "title":"Fælles undervejs"\n },\n {\n "branchId":"FBS-751025",\n "title":"Fællessekretariatet"\n },\n {\n "branchId":"DK-775133",\n "title":"Bavnehøj"\n },\n {\n "branchId":"FBS-751024",\n "title":"Fjernlånte materialer"\n },\n {\n "branchId":"DK-775100",\n "title":"Hovedbiblioteket"\n },\n {\n "branchId":"DK-775170",\n "title":"Trige"\n },\n {\n "branchId":"DK-775150",\n "title":"Tilst"\n },\n {\n "branchId":"DK-775130",\n "title":"Viby"\n },\n {\n "branchId":"DK-775164",\n "title":"Egå"\n }\n]',
control: { type: "text" }
},
addToFavoritesAriaLabelText: {
control: {
type: "text"
},
defaultValue: "Add @title to favorites list"
},
removeFromFavoritesAriaLabelText: {
control: {
type: "text"
},
defaultValue: "Remove @title from favorites list"
},
alertErrorCloseText: {
name: "Alert error close text",
defaultValue: "close",
control: { type: "text" }
},
alertErrorMessageText: {
name: "Alert error message text",
defaultValue: "An error occurred",
control: { type: "text" }
},
loadingText: {
name: "Loading",
defaultValue: "Loading",
Expand Down Expand Up @@ -357,11 +337,6 @@ export default {
name: "Advanced search filter - non-fiction",
defaultValue: "Non-fiction",
control: { type: "text" }
},
multiselectAllOptionText: {
name: "Multiselect - all option",
defaultValue: "All",
control: { type: "text" }
}
}
} as ComponentMeta<typeof AdvancedSearchEntry>;
Expand Down
7 changes: 2 additions & 5 deletions src/apps/advanced-search/AdvancedSearch.entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,14 @@ import { withText } from "../../core/utils/text";
import { withUrls } from "../../core/utils/url";
import GlobalUrlEntryPropsInterface from "../../core/utils/types/global-url-props";
import AdvancedSearch from "./AdvancedSearch";
import { GlobalEntryTextProps } from "../../core/storybook/globalTextArgs";

interface AdvancedSearchEntryTextProps {
addToFavoritesAriaLabelText: string;
alertErrorCloseText: string;
alertErrorMessageText: string;
byAuthorText: string;
etAlText: string;
inSeriesText: string;
loadingText: string;
numberDescriptionText: string;
removeFromFavoritesAriaLabelText: string;
resultPagerStatusText: string;
noSearchResultText: string;
showMoreText: string;
Expand Down Expand Up @@ -67,7 +64,6 @@ interface AdvancedSearchEntryTextProps {
advancedSearchFilterOnlineText: string;
advancedSearchFilterFictionText: string;
advancedSearchFilterNonFictionText: string;
multiselectAllOptionText: string;
}

interface AdvancedSearchEntryConfigProps {
Expand All @@ -79,6 +75,7 @@ interface AdvancedSearchEntryConfigProps {

export interface AdvancedSearchEntryProps
extends GlobalUrlEntryPropsInterface,
GlobalEntryTextProps,
AdvancedSearchEntryConfigProps,
AdvancedSearchEntryTextProps {
pageSizeDesktop?: number;
Expand Down
6 changes: 3 additions & 3 deletions src/apps/advanced-search/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ export const initialAdvancedSearchQuery: AdvancedSearchQuery = {
{ term: "", searchIndex: "all", clause: advancedSearchClauses[0], id: 1 }
],
filters: {
materialTypes: [{ item: "All", value: "all" }],
fiction: [{ item: "All", value: "all" }],
accessibility: [{ item: "All", value: "all" }]
materialTypes: [{ item: "multiselectAllOptionText", value: "all" }],
fiction: [{ item: "multiselectAllOptionText", value: "all" }],
accessibility: [{ item: "multiselectAllOptionText", value: "all" }]
}
};

Expand Down
10 changes: 4 additions & 6 deletions src/apps/create-patron-user-info/CreatePatron.dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import { ComponentMeta, ComponentStory } from "@storybook/react";
import CreatePatron from "./CreatePatron.entry";
import serviceUrlArgs from "../../core/storybook/serviceUrlArgs";
import pincodeArgs from "../../core/storybook/pincodeArgs";
import globalTextArgs from "../../core/storybook/globalTextArgs";

export default {
title: "Apps / Create patron",
component: CreatePatron,
argTypes: {
...serviceUrlArgs,
...pincodeArgs,
...globalTextArgs,
blacklistedPickupBranchesConfig: {
defaultValue: "FBS-751032,FBS-751031,FBS-751009,FBS-751027,FBS-751024",
control: { type: "text" }
Expand Down Expand Up @@ -85,10 +87,6 @@ export default {
defaultValue: "Phone number",
control: { type: "text" }
},
patronContactInfoBodyText: {
defaultValue: "Please enter contact information below",
control: { type: "text" }
},
patronContactInfoHeaderText: {
defaultValue: "Contact information",
control: { type: "text" }
Expand All @@ -108,11 +106,11 @@ export default {
control: { type: "text" }
},
createPatronChangePickupHeaderText: {
defaultValue: "",
defaultValue: "Create patron change pickup header text",
control: { type: "text" }
},
createPatronChangePickupBodyText: {
defaultValue: "",
defaultValue: "Create patron change pickup body text",
control: { type: "text" }
},
createPatronHeaderText: {
Expand Down
3 changes: 2 additions & 1 deletion src/apps/create-patron-user-info/CreatePatron.entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { withText } from "../../core/utils/text";
import { withUrls } from "../../core/utils/url";
import CreatePatron from "./CreatePatron";
import { getToken, hasToken } from "../../core/token";
import { GlobalEntryTextProps } from "../../core/storybook/globalTextArgs";

interface CreatePatronConfigProps {
agencyConfig: string;
Expand Down Expand Up @@ -32,7 +33,6 @@ interface CreatePatronTextProps {
createPatronInvalidSSNHeaderText: string;
patronContactEmailCheckboxText: string;
patronContactEmailLabelText: string;
patronContactInfoBodyText: string;
patronContactInfoHeaderText: string;
patronContactNameLabelText: string;
patronContactPhoneCheckboxText: string;
Expand All @@ -49,6 +49,7 @@ interface CreatePatronTextProps {

export interface CreatePatronProps
extends CreatePatronConfigProps,
GlobalEntryTextProps,
CreatePatronUrlProps,
CreatePatronTextProps {}

Expand Down
12 changes: 2 additions & 10 deletions src/apps/dashboard/dashboard.dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import reservationGroupModalArgs from "../../core/storybook/reservationGroupModa
import reservationMaterialDetailsProps from "../../core/storybook/reservationMaterialDetailsArgs";
import materialDetailsModalArgs from "../../core/storybook/materialDetailsModalArgs";
import deleteReservationModalArgs from "../../core/storybook/deleteReservationModalArgs";
import acceptModalArgs from "../../core/storybook/acceptFeesModalArgs";
import reservationListArgs from "../../core/storybook/reservationListArgs";
import globalTextArgs from "../../core/storybook/globalTextArgs";

export default {
title: "Apps / Dashboard",
Expand All @@ -21,10 +21,10 @@ export default {
...renewalArgs,
...reservationGroupModalArgs,
...reservationMaterialDetailsProps,
...acceptModalArgs,
...materialDetailsModalArgs,
...deleteReservationModalArgs,
...reservationListArgs,
...globalTextArgs,
// Urls
physicalLoansUrl: {
defaultValue: "/user/me/loans",
Expand Down Expand Up @@ -70,10 +70,6 @@ export default {
defaultValue: "To be returned soon",
control: { type: "text" }
},
loansNotOverdueText: {
defaultValue: "Longer return time",
control: { type: "text" }
},
reservationsText: {
defaultValue: "Reservations",
control: { type: "text" }
Expand All @@ -86,10 +82,6 @@ export default {
defaultValue: "Ready for you",
control: { type: "text" }
},
reservationsStillInQueueForText: {
defaultValue: "Still in queue",
control: { type: "text" }
},
noPhysicalLoansText: {
defaultValue: "At the moment, you have 0 physical loans",
control: { type: "text" }
Expand Down
9 changes: 3 additions & 6 deletions src/apps/dashboard/dashboard.entry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { ReservationMaterialDetailsProps } from "../../core/storybook/reservatio
import { MaterialDetailsModalProps } from "../../core/storybook/materialDetailsModalArgs";
import { GroupModalReservationsProps } from "../../core/storybook/reservationGroupModalArgs";
import { DeleteReservationModalArgs } from "../../core/storybook/deleteReservationModalArgs";
import { AcceptFeesModalEntryTextProps } from "../../core/storybook/acceptFeesModalArgs";
import { RenewalArgs } from "../../core/storybook/renewalArgs";
import { GlobalEntryTextProps } from "../../core/storybook/globalTextArgs";

export interface DashBoardProps {
// Url
Expand All @@ -26,7 +26,6 @@ export interface DashBoardProps {
expirationWarningDaysBeforeConfig: string;
// Texts
dashboardNumberInLineText: string;
deleteReservationModalButtonText: string;
deleteReservationModalDeleteButtonText: string;
deleteReservationModalDeleteProcessingText: string;
deleteReservationModalErrorsStatusText: string;
Expand All @@ -36,7 +35,6 @@ export interface DashBoardProps {
etAlText: string;
feesText: string;
loanListMaterialDaysText: string;
loansNotOverdueText: string;
loansOverdueText: string;
loansSoonOverdueText: string;
materialAndAuthorText: string;
Expand All @@ -52,7 +50,6 @@ export interface DashBoardProps {
readyForLoanText: string;
reservationDetailsOthersInQueueText: string;
reservationsReadyText: string;
reservationsStillInQueueForText: string;
reservationsText: string;
resultPagerStatusText: string;
statusBadgeWarningText: string;
Expand All @@ -66,11 +63,11 @@ const DashboardEntry: FC<
GroupModalProps &
GroupModalLoansProps &
DeleteReservationModalArgs &
AcceptFeesModalEntryTextProps &
GroupModalReservationsProps &
RenewalArgs &
ReservationMaterialDetailsProps &
MaterialDetailsModalProps
MaterialDetailsModalProps &
GlobalEntryTextProps
> = ({ pageSizeDesktop, pageSizeMobile }) => {
const pageSize = pageSizeGlobal(
{
Expand Down
6 changes: 5 additions & 1 deletion src/apps/demo-modal/demo-modal.dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { ComponentMeta, ComponentStory } from "@storybook/react";
import React from "react";
import { withQuery } from "@storybook/addon-queryparams";
import DemoModal, { DemoModalEntryProps } from "./demo-modal.entry";
import globalTextArgs, {
GlobalEntryTextProps
} from "../../core/storybook/globalTextArgs";

export default {
title: "Apps / Demo modal",
Expand All @@ -13,6 +16,7 @@ export default {
}
},
argTypes: {
...globalTextArgs,
ariaLabelModalOneText: {
defaultValue: "Luk dialog et"
},
Expand All @@ -26,5 +30,5 @@ export default {
} as ComponentMeta<typeof DemoModal>;

export const App: ComponentStory<typeof DemoModal> = (
props: DemoModalEntryProps
props: DemoModalEntryProps & GlobalEntryTextProps
) => <DemoModal {...props} />;
3 changes: 2 additions & 1 deletion src/apps/demo-modal/demo-modal.entry.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import React from "react";
import { withText } from "../../core/utils/text";
import DemoModal from "./demo-modal";
import { GlobalEntryTextProps } from "../../core/storybook/globalTextArgs";

export interface DemoModalEntryProps {
ariaLabelModalOneText: string;
ariaLabelModalTwoText: string;
screenReaderModalDescriptionText: string;
}

const DemoModalEntry: React.FC<DemoModalEntryProps> = (
const DemoModalEntry: React.FC<DemoModalEntryProps & GlobalEntryTextProps> = (
props: DemoModalEntryProps
) => <DemoModal />;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ import React from "react";
import { withQuery } from "@storybook/addon-queryparams";
import serviceUrlArgs from "../../core/storybook/serviceUrlArgs";
import FavoritesListMaterialComponent from "./FavoritesListMaterialComponent.entry";
import globalTextArgs from "../../core/storybook/globalTextArgs";

export default {
title: "Apps / Favorites list material component",
component: FavoritesListMaterialComponent,
decorators: [withQuery],
argTypes: {
...serviceUrlArgs,
...globalTextArgs,
favoritesListMaterialComponentTitleText: {
control: {
type: "text"
Expand Down Expand Up @@ -49,18 +51,6 @@ export default {
type: "text"
},
defaultValue: "https://unsplash.com/photos/wd6YQy0PJt8" // open source image of a red panda
},
addToFavoritesAriaLabelText: {
control: {
type: "text"
},
defaultValue: "Add @title to favorites list"
},
removeFromFavoritesAriaLabelText: {
control: {
type: "text"
},
defaultValue: "Remove @title from favorites list"
}
}
} as ComponentMeta<typeof FavoritesListMaterialComponent>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import FavoritesListMaterialComponent from "./FavoritesListMaterialComponent";
import { withText } from "../../core/utils/text";
import { withConfig } from "../../core/utils/config";
import { withUrls } from "../../core/utils/url";
import { FaustId } from "../../core/utils/types/ids";
import { GlobalEntryTextProps } from "../../core/storybook/globalTextArgs";

export interface FavoritesListMaterialComponentProps {
fbsBaseUrl: string;
Expand All @@ -19,11 +19,11 @@ export interface FavoritesListMaterialComponentProps {
etAlText: string;
favoritesListMaterialComponentGoToListText: string;
favoritesListMaterialComponentGoToListUrl: string;
addToFavoritesAriaLabelText: string;
removeFromFavoritesAriaLabelText: string;
}

const SomethingSimilarEntry: FC<FavoritesListMaterialComponentProps> = () => {
const SomethingSimilarEntry: FC<
FavoritesListMaterialComponentProps & GlobalEntryTextProps
> = () => {
return <FavoritesListMaterialComponent />;
};

Expand Down
12 changes: 2 additions & 10 deletions src/apps/favorites-list/FavoritesList.dev.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import serviceUrlArgs from "../../core/storybook/serviceUrlArgs";
import FavoritesListEntry, {
FavoritesListEntryProps
} from "./FavoritesList.entry";
import globalTextArgs from "../../core/storybook/globalTextArgs";

export default {
title: "Apps / Favorite list",
component: FavoritesListEntry,
argTypes: {
...serviceUrlArgs,
...globalTextArgs,
pageSizeDesktop: {
name: "Number of favorite items on desktop",
defaultValue: 50,
Expand Down Expand Up @@ -46,16 +48,6 @@ export default {
defaultValue: "/work/:workid",
control: { type: "text" }
},
availabilityAvailableText: {
name: "Availability: available text",
defaultValue: "Available",
control: { type: "text" }
},
availabilityUnavailableText: {
name: "Availability: unavailable text",
defaultValue: "Unavailable",
control: { type: "text" }
},
favoritesListMaterialsText: {
defaultValue: "@count materials",
control: { type: "text" }
Expand Down
Loading
Loading