Skip to content

Commit a735df8

Browse files
committed
address copilot i18n comments
1 parent 3b8ef0b commit a735df8

11 files changed

Lines changed: 176 additions & 95 deletions

File tree

.github/workflows/validate-app.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ jobs:
2727

2828
- name: Run app checks
2929
run: npm run check
30+
31+
- name: Build app
32+
run: npm run build

messages/de.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
},
7575
"Errors": {
7676
"alreadyYourEmail": "Das ist bereits deine E-Mail-Adresse.",
77-
"emptyListingName": "Der Name für {type} darf nicht leer sein.",
77+
"emptyListingName": "{type, select, business {Der Name des Unternehmens darf nicht leer sein.} community {Der Name der Community darf nicht leer sein.} other {Der Name des Eintrags darf nicht leer sein.}}",
7878
"emptyName": "Der Name darf nicht leer sein.",
7979
"accountDeleted": "Dein Konto wurde gelöscht. Schade, dass du gehst.",
8080
"accountExists": "Ein Konto mit dieser E-Mail existiert bereits. Bitte melde dich stattdessen an.",
@@ -164,8 +164,8 @@
164164
"Profile": {
165165
"addListing": "Eintrag hinzufügen",
166166
"addAnotherListing": "Weiteren Eintrag hinzufügen",
167-
"listingCardAlt": "Dein Avatar für diesen {type}-Eintrag",
168-
"listingCardType": "{type}-Eintrag",
167+
"listingCardAlt": "{type, select, residential {Dein Avatar für diesen Wohneintrag} community {Dein Avatar für diesen Community-Eintrag} business {Dein Avatar für diesen Unternehmenseintrag} other {Dein Avatar für diesen Eintrag}}",
168+
"listingCardType": "{type, select, residential {Wohneintrag} community {Community-Eintrag} business {Unternehmenseintrag} other {Eintrag}}",
169169
"listingPrompt": "Setze dich, deinen Gemeinschaftsort oder dein Unternehmen auf die Karte",
170170
"sections": {
171171
"listings": "Einträge",
@@ -260,13 +260,13 @@
260260
"form": {
261261
"basics": "Grundlagen",
262262
"placeName": "Name des Ortes",
263-
"placeNamePlaceholder": "Name deines {type}",
263+
"placeNamePlaceholder": "{type, select, business {Name deines Unternehmens} community {Name deiner Community} other {Name des Ortes}}",
264264
"yourFirstName": "Dein Vorname",
265265
"location": "Standort",
266266
"selectCountry": "Land auswählen",
267267
"locationPlaceholder": "Deine Straße oder ein Ort in der Nähe",
268268
"customLocation": "Benutzerdefinierter Standort",
269-
"locationHint": "Beginne zu tippen und wähle dann einen der vorgeschlagenen {kind} aus dem Menü.",
269+
"locationHint": "{type, select, residential {Beginne zu tippen und wähle dann eine der vorgeschlagenen Optionen aus dem Menü.} other {Beginne zu tippen und wähle dann eine der vorgeschlagenen Adressen aus dem Menü.}}",
270270
"dragPinHint": "Ziehe die Markierung, um deinen Standort zu verfeinern{obscure, select, true { oder zu verschleiern} other {}}.",
271271
"businessAddress": "Adresse deines Unternehmens",
272272
"communityAddress": "Adresse deiner Gemeinschaft",
@@ -275,7 +275,7 @@
275275
"donationDetailsPlaceholder": "Details zu deiner Spende",
276276
"donationDetailsHint": "Welche Reste du abgeben möchtest und wie die Abholung funktioniert. Links gehören in den eigenen Abschnitt weiter unten.",
277277
"descriptionLabel": "Kurze Beschreibung oder Hinweise",
278-
"descriptionPlaceholder": "Über deinen {type}",
278+
"descriptionPlaceholder": "{type, select, residential {Über deinen Eintrag} community {Über deine Community} business {Über dein Unternehmen} other {Über deinen Eintrag}}",
279279
"communityDescriptionHint": "Öffnungszeiten und Kompostiermöglichkeiten. Hebe die akzeptierten Reste und Links für die eigenen Abschnitte weiter unten auf.",
280280
"residentialDescriptionHint": "Dein Kompost-Setup und deine allgemeine Verfügbarkeit. Hebe die akzeptierten Reste für den eigenen Abschnitt weiter unten auf.",
281281
"compostingDetails": "Kompostierungsdetails",

messages/en.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
},
7575
"Errors": {
7676
"alreadyYourEmail": "This is already your email address.",
77-
"emptyListingName": "You can't have an empty {type} name.",
77+
"emptyListingName": "{type, select, business {You can't have an empty business name.} community {You can't have an empty community name.} other {You can't have an empty listing name.}}",
7878
"emptyName": "You can’t have an empty name.",
7979
"accountDeleted": "Your account has been deleted. Sorry to see you go.",
8080
"accountExists": "An account with this email already exists. Please sign in instead.",
@@ -164,8 +164,8 @@
164164
"Profile": {
165165
"addListing": "Add a listing",
166166
"addAnotherListing": "Add another listing",
167-
"listingCardAlt": "Your avatar for this {type} listing",
168-
"listingCardType": "{type} listing",
167+
"listingCardAlt": "{type, select, residential {Your avatar for this residential listing} community {Your avatar for this community listing} business {Your avatar for this business listing} other {Your avatar for this listing}}",
168+
"listingCardType": "{type, select, residential {Residential listing} community {Community listing} business {Business listing} other {Listing}}",
169169
"listingPrompt": "Put yourself, your community spot, or your business on the map",
170170
"sections": {
171171
"listings": "Listings",
@@ -260,13 +260,13 @@
260260
"form": {
261261
"basics": "Basics",
262262
"placeName": "Place name",
263-
"placeNamePlaceholder": "Your {type} name",
263+
"placeNamePlaceholder": "{type, select, business {Your business’ name} community {Your community’s name} other {Your place name}}",
264264
"yourFirstName": "Your first name",
265265
"location": "Location",
266266
"selectCountry": "Select a country",
267267
"locationPlaceholder": "Your street name or nearby",
268268
"customLocation": "Custom location",
269-
"locationHint": "Start typing, then select one of the suggested {kind} from the dropdown.",
269+
"locationHint": "{type, select, residential {Start typing, then select one of the suggested options from the dropdown.} other {Start typing, then select one of the suggested addresses from the dropdown.}}",
270270
"dragPinHint": "Drag the pin to refine{obscure, select, true { or obscure} other {}} your location.",
271271
"businessAddress": "Your business’ address",
272272
"communityAddress": "Your community’s address",
@@ -275,7 +275,7 @@
275275
"donationDetailsPlaceholder": "Your donation details",
276276
"donationDetailsHint": "What kind of scraps you have to give away and the collection details. Save any links for the dedicated section, below.",
277277
"descriptionLabel": "Short description or instructions",
278-
"descriptionPlaceholder": "About your {type}",
278+
"descriptionPlaceholder": "{type, select, residential {About your listing} community {About your community} business {About your business} other {About your listing}}",
279279
"communityDescriptionHint": "Opening hours and composting facilities. Save the scraps you accept and any links for the dedicated sections, below.",
280280
"residentialDescriptionHint": "Your composting set up and general availability. Save the scraps you accept for the dedicated section, below.",
281281
"compostingDetails": "Composting details",

messages/es.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
},
7575
"Errors": {
7676
"alreadyYourEmail": "Esta ya es tu dirección de correo electrónico.",
77-
"emptyListingName": "No puedes dejar vacío el nombre de {type}.",
77+
"emptyListingName": "{type, select, business {No puedes dejar vacío el nombre del negocio.} community {No puedes dejar vacío el nombre de la comunidad.} other {No puedes dejar vacío el nombre del anuncio.}}",
7878
"emptyName": "No puedes dejar el nombre vacío.",
7979
"accountDeleted": "Tu cuenta ha sido eliminada. Sentimos verte partir.",
8080
"accountExists": "Ya existe una cuenta con este correo. Inicia sesión en su lugar.",
@@ -164,8 +164,8 @@
164164
"Profile": {
165165
"addListing": "Agregar un anuncio",
166166
"addAnotherListing": "Agregar otro anuncio",
167-
"listingCardAlt": "Tu avatar para este anuncio de {type}",
168-
"listingCardType": "Anuncio de {type}",
167+
"listingCardAlt": "{type, select, residential {Tu avatar para este anuncio residencial} community {Tu avatar para este anuncio comunitario} business {Tu avatar para este anuncio de negocio} other {Tu avatar para este anuncio}}",
168+
"listingCardType": "{type, select, residential {Anuncio residencial} community {Anuncio comunitario} business {Anuncio de negocio} other {Anuncio}}",
169169
"listingPrompt": "Ponte a ti, a tu espacio comunitario o a tu negocio en el mapa",
170170
"sections": {
171171
"listings": "Anuncios",
@@ -260,13 +260,13 @@
260260
"form": {
261261
"basics": "Datos básicos",
262262
"placeName": "Nombre del lugar",
263-
"placeNamePlaceholder": "Nombre de tu {type}",
263+
"placeNamePlaceholder": "{type, select, business {Nombre de tu negocio} community {Nombre de tu comunidad} other {Nombre del lugar}}",
264264
"yourFirstName": "Tu nombre",
265265
"location": "Ubicación",
266266
"selectCountry": "Selecciona un país",
267267
"locationPlaceholder": "Tu calle o un lugar cercano",
268268
"customLocation": "Ubicación personalizada",
269-
"locationHint": "Empieza a escribir y selecciona una de las {kind} sugeridas en el menú.",
269+
"locationHint": "{type, select, residential {Empieza a escribir y selecciona una de las opciones sugeridas en el menú.} other {Empieza a escribir y selecciona una de las direcciones sugeridas en el menú.}}",
270270
"dragPinHint": "Arrastra el pin para ajustar{obscure, select, true { u ocultar} other {}} tu ubicación.",
271271
"businessAddress": "Dirección de tu negocio",
272272
"communityAddress": "Dirección de tu comunidad",
@@ -275,7 +275,7 @@
275275
"donationDetailsPlaceholder": "Detalles de tu donación",
276276
"donationDetailsHint": "Qué tipo de restos tienes para donar y los detalles de recogida. Guarda los enlaces para la sección dedicada, más abajo.",
277277
"descriptionLabel": "Descripción breve o instrucciones",
278-
"descriptionPlaceholder": "Acerca de tu {type}",
278+
"descriptionPlaceholder": "{type, select, residential {Acerca de tu anuncio} community {Acerca de tu comunidad} business {Acerca de tu negocio} other {Acerca de tu anuncio}}",
279279
"communityDescriptionHint": "Horarios de apertura e instalaciones de compostaje. Guarda los restos que aceptas y cualquier enlace para las secciones dedicadas, más abajo.",
280280
"residentialDescriptionHint": "Tu sistema de compostaje y disponibilidad general. Guarda los restos que aceptas para la sección dedicada, más abajo.",
281281
"compostingDetails": "Detalles de compostaje",
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Label as HeadlessLabel } from "@headlessui/react";
22
import { styled } from "@pigment-css/react";
3-
import { useTranslations } from "next-intl";
3+
import type { ComponentProps, ReactNode } from "react";
44

55
const StyledLabel = styled(HeadlessLabel)(({ theme }) => ({
66
color: theme.colors.text.ui.primary,
@@ -12,12 +12,21 @@ const StyledLabel = styled(HeadlessLabel)(({ theme }) => ({
1212
},
1313
}));
1414

15-
export default function Label({ required = true, children, ...props }) {
16-
const t = useTranslations("Common");
15+
type LabelProps = ComponentProps<typeof HeadlessLabel> & {
16+
required?: boolean;
17+
optionalText?: string;
18+
children: ReactNode;
19+
};
1720

21+
export default function Label({
22+
required = true,
23+
optionalText = "",
24+
children,
25+
...props
26+
}: LabelProps) {
1827
return (
1928
<StyledLabel {...props}>
20-
{children} {!required && <span>({t("optional")})</span>}
29+
{children} {!required && optionalText && <span>({optionalText})</span>}
2130
</StyledLabel>
2231
);
2332
}

src/components/LegalFooter/LegalFooter.jsx renamed to src/components/LegalFooter/LegalFooter.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { siteConfig } from "@/config/site";
22
import Link from "next/link";
33
import PeelsLogo from "@/components/PeelsLogo";
44
import { styled } from "@pigment-css/react";
5-
import { useTranslations } from "next-intl";
5+
import { getTranslations } from "next-intl/server";
66

77
const currentYear = new Date().getFullYear();
88

9-
export default function LegalFooter() {
10-
const t = useTranslations();
9+
export default async function LegalFooter() {
10+
const t = await getTranslations();
1111

1212
return (
1313
<StyledFooter>

src/components/ListingWrite/ListingWrite.tsx

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,7 @@ export default function ListingWrite({
401401
type="text"
402402
minLength={FIELD_CONFIGS.firstName.minLength}
403403
placeholder={t("Listings.form.placeNamePlaceholder", {
404-
type:
405-
listingType === "business"
406-
? "business’"
407-
: `${listingType}’s`,
404+
type: listingType,
408405
})}
409406
value={name}
410407
onChange={(event: React.ChangeEvent<HTMLInputElement>) =>
@@ -463,7 +460,11 @@ export default function ListingWrite({
463460
</Field>
464461
) : (
465462
<Field>
466-
<Label htmlFor="description" required={false}>
463+
<Label
464+
htmlFor="description"
465+
required={false}
466+
optionalText={t("Common.optional")}
467+
>
467468
{t("Listings.form.descriptionLabel")}
468469
</Label>
469470
<TextareaComponent
@@ -473,7 +474,7 @@ export default function ListingWrite({
473474
required={false}
474475
resize="vertical"
475476
placeholder={t("Listings.form.descriptionPlaceholder", {
476-
type: listingType === "residential" ? "listing" : listingType,
477+
type: listingType,
477478
})}
478479
value={description}
479480
onChange={(event: React.ChangeEvent<HTMLTextAreaElement>) =>
@@ -500,6 +501,7 @@ export default function ListingWrite({
500501
label={t("Listings.form.acceptedLabel")}
501502
addButtonText={t("Listings.form.addItem")}
502503
addAnotherButtonText={t("Listings.form.addAnotherItem")}
504+
optionalText={t("Common.optional")}
503505
placeholder={t("Listings.form.acceptedPlaceholder")}
504506
secondaryPlaceholder={t(
505507
"Listings.form.acceptedSecondaryPlaceholder"
@@ -515,6 +517,7 @@ export default function ListingWrite({
515517
label={t("Listings.form.rejectedLabel")}
516518
addButtonText={t("Listings.form.addItem")}
517519
addAnotherButtonText={t("Listings.form.addAnotherItem")}
520+
optionalText={t("Common.optional")}
518521
placeholder={t("Listings.form.rejectedPlaceholder")}
519522
secondaryPlaceholder={t(
520523
"Listings.form.rejectedSecondaryPlaceholder"
@@ -543,7 +546,11 @@ export default function ListingWrite({
543546
</FormSectionHeader>
544547

545548
<FieldsetWithGap>
546-
<Label htmlFor="photo-upload-button" required={false}>
549+
<Label
550+
htmlFor="photo-upload-button"
551+
required={false}
552+
optionalText={t("Common.optional")}
553+
>
547554
{t("Common.photos")}
548555
</Label>
549556
<ListingPhotosManagerComponent
@@ -560,6 +567,7 @@ export default function ListingWrite({
560567
label={t("Listings.form.externalLinks")}
561568
required={false}
562569
addButtonText={t("Listings.form.addLink")}
570+
optionalText={t("Common.optional")}
563571
placeholder={t("Listings.form.linkPlaceholder")}
564572
items={links}
565573
handleItemChange={handleLinksChange}

0 commit comments

Comments
 (0)