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

V3-translations for static variables #868

Merged
merged 2 commits into from
Nov 7, 2024
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
19 changes: 17 additions & 2 deletions messages/en.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
{
"CustomerCase": {
"navigation": {
"home": "Home"
},
"customer_case": {
"customer": "Customer",
"project": "Project",
"duration": "Duration"
"duration": "Duration",
"industry": "Industry",
"delivery": "Delivery",
"consultants": "Consultants",
"in_project": "In project"
},
"contact_information": {
"help": "Curious about Variant and want to explore what we offer?",
"contact_sale": "Contact sale!"
},
"custom_link": {
"visit_cv": "Visit mini-CV",
"read_more": "Read more"
}
}
19 changes: 17 additions & 2 deletions messages/no.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
{
"CustomerCase": {
"navigation": {
"home": "Hjem"
},
"customer_case": {
"customer": "Kunde",
"project": "Prosjekt",
"duration": "Varighet"
"duration": "Varighet",
"industry": "Bransje",
"delivery": "Leveranse",
"consultants": "Folk",
"in_project": "Varianter i prosjektet"
},
"contact_information": {
"help": "Trenger du hjelp med lignende eller noe helt annet?",
"contact_sale": "Kontakt salg!"
},
"custom_link": {
"visit_cv": "Gå til mini-CV",
"read_more": "Les mer"
}
}
17 changes: 16 additions & 1 deletion messages/se.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
{
"navigation": {
"home": "Hem"
},
"CustomerCase": {
"customer": "Kund",
"project": "Projekt",
"duration": "Varaktighet"
"duration": "Varaktighet",
"industry": "Bransch",
"delivery": "Leverans",
"consultants": "Folk",
"in_project": "Varianter i projektet"
},
"contact_information": {
"help": "Nyfiken på Variant och vill utforska vad vi erbjuder?",
"contact_sale": "Kontakta sälj!"
},
"custom_link": {
"visit_cv": "Besök mini-CV",
"read_more": "Läs mer"
}
}
5 changes: 4 additions & 1 deletion src/components/consultantCard/ConsultantCard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Image from "next/image";
import Link from "next/link";
import { useTranslations } from "next-intl";

import CustomLink from "src/components/link/CustomLink";
import { ChewbaccaEmployee } from "src/types/employees";
Expand All @@ -20,6 +21,8 @@ export default function ConsultantCard({
employeePageSlug,
}: ConsultantCardProps) {
const title = <p className={styles.consultantName}>{consultant.name}</p>;
const t = useTranslations("custom_link");

return (
consultant.imageThumbUrl &&
consultant.name &&
Expand Down Expand Up @@ -59,7 +62,7 @@ export default function ConsultantCard({
_key: "go-to-mini-cv",
_type: "link",
linkType: LinkType.Internal,
linkTitle: "Gå til Mini-CV", // TODO: translate
linkTitle: t("visit_cv"),
language: currentLanguage,
internalLink: {
_ref: `${employeePageSlug}/${aliasFromEmail(consultant.email)}`,
Expand Down
8 changes: 4 additions & 4 deletions src/components/customerCases/customerCase/CustomerCase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default async function CustomerCase({
customerCase.projectInfo.consultants,
);

const t = await getTranslations("CustomerCase");
const t = await getTranslations("customer_case");

return (
<div className={styles.wrapper}>
Expand Down Expand Up @@ -78,7 +78,7 @@ export default async function CustomerCase({
)}
{customerCase.projectInfo.sector && (
<div className={styles.projectInfoItem}>
<Text type={"labelRegular"}>Bransje</Text>
<Text type={"labelRegular"}>{t("industry")}</Text>
<Text
type={"labelLight"}
className={styles.projectInfoItemBadge}
Expand All @@ -89,7 +89,7 @@ export default async function CustomerCase({
)}
{customerCase.projectInfo.deliveries && (
<div className={styles.projectInfoItem}>
<Text type={"labelRegular"}>Leveranse</Text>
<Text type={"labelRegular"}>{t("delivery")}</Text>
{customerCase.projectInfo.deliveries.map(
(delivery: Delivery) => (
<Text
Expand All @@ -105,7 +105,7 @@ export default async function CustomerCase({
)}
{consultantsResult.ok && (
<div className={styles.projectInfoItem}>
<Text type={"labelRegular"}>Konsulenter</Text>
<Text type={"labelRegular"}>{t("consultants")}</Text>
<Text
type={"labelLight"}
className={styles.projectInfoItemValue}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { getTranslations } from "next-intl/server";

import Text from "src/components/text/Text";
import { fetchEmployeesByEmails } from "src/utils/employees";
import { CompanyLocation } from "studio/lib/interfaces/companyDetails";
Expand Down Expand Up @@ -50,16 +52,13 @@ export default async function ContactInformation({
const locationsWithContact = companyLocations.filter((location) =>
locationIdsWithContact.includes(location._id),
);

const t = await getTranslations("contact_information");
return (
<div className={styles.wrapper}>
<div className={styles.content}>
<div className={styles.titleSection}>
{/* TODO: translation */}
<Text type={"bodyXl"}>
Trenger du hjelp med lignende eller noe helt annet?
</Text>
<Text type="bodyBig"> Kontakt salg! </Text>
<Text type={"bodyXl"}>{t("help")}</Text>
<Text type="bodyBig">{t("contact_sale")} </Text>
</div>
<div className={styles.contactSection}>
<ContactSelector
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { getTranslations } from "next-intl/server";

import ConsultantCard from "src/components/consultantCard/ConsultantCard";
import Text from "src/components/text/Text";
import { ChewbaccaEmployee } from "src/types/employees";
Expand All @@ -23,9 +25,11 @@ export default async function CustomerCaseConsultants({
);
const employeePageSlug = employeePageSlugRes.data?.slug;

const t = await getTranslations("customer_case");

return (
<div className={styles.wrapper}>
<Text type={"h3"}>Varianter på prosjektet</Text>
<Text type={"h3"}>{t("in_project")}</Text>
<div className={styles.content}>
{consultants.map((consultant) => (
<ConsultantCard
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useTranslations } from "next-intl";

import CustomLink from "src/components/link/CustomLink";
import Text from "src/components/text/Text";
import { LinkType } from "studio/lib/interfaces/navigation";
Expand All @@ -10,6 +12,7 @@ export interface TextSectionProps {
}

export default function TextSection({ section }: TextSectionProps) {
const t = useTranslations("custom_link");
return (
<div className={styles.wrapper}>
<div
Expand All @@ -35,7 +38,7 @@ export default function TextSection({ section }: TextSectionProps) {
_key: "read-more",
_type: "link",
linkType: LinkType.External,
linkTitle: "Les mer", //Todo: Add translation
linkTitle: t("read_more"),
newTab: true,
url: section.url,
}}
Expand Down
5 changes: 3 additions & 2 deletions src/components/navigation/breadCrumbMenu/BreadCrumbMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Link from "next/link";
import { useTranslations } from "next-intl";

import Text from "src/components/text/Text";

Expand All @@ -15,11 +16,11 @@ export const BreadCrumbMenu = ({
pathTitles,
pathname,
}: BreadCrumbProps) => {
const t = useTranslations("navigation");
return (
<ul className={styles.breadCrumbMenu}>
{/* TODO: "Hjem" should be updated with translation */}
{[
"Hjem",
t("home"),
...(pathname.includes(`/${currentLanguage}/`)
? pathname.split("/").slice(2)
: pathname.split("/").slice(1)),
Expand Down