Skip to content

Commit

Permalink
delete german dictionary, remove (en) prefixes from translations & al…
Browse files Browse the repository at this point in the history
…ign naming
  • Loading branch information
bc-alexsaiannyi committed Mar 4, 2024
1 parent 3686f74 commit a991549
Show file tree
Hide file tree
Showing 16 changed files with 261 additions and 502 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default async function Brand({ params: { slug, locale }, searchParams }:

const t = await getTranslations({ locale, namespace: 'Brand' });
const tPagination = await getTranslations({ locale, namespace: 'Pagination' });
const dictionary = await getMessages({ locale });
const messages = await getMessages({ locale });

const brandId = Number(slug);

Expand All @@ -64,7 +64,7 @@ export default async function Brand({ params: { slug, locale }, searchParams }:
<div>
<NextIntlClientProvider
locale={locale}
messages={pick(dictionary, ['FacetedGroup', 'Product'])}
messages={pick(messages, ['FacetedGroup', 'Product'])}
>
<div className="md:mb-8 lg:flex lg:flex-row lg:items-center lg:justify-between">
<h1 className="mb-4 text-4xl font-black lg:mb-0 lg:text-5xl">{brand.name}</h1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default async function Category({ params: { locale, slug }, searchParams

const t = await getTranslations({ locale, namespace: 'Category' });
const tPagination = await getTranslations({ locale, namespace: 'Pagination' });
const dictionary = await getMessages({ locale });
const messages = await getMessages({ locale });

const categoryId = Number(slug);
const search = await fetchFacetedSearch({ ...searchParams, category: [slug] });
Expand All @@ -68,7 +68,7 @@ export default async function Category({ params: { locale, slug }, searchParams
<Breadcrumbs breadcrumbs={category.breadcrumbs.items} category={category.name} />
<NextIntlClientProvider
locale={locale}
messages={pick(dictionary, ['FacetedGroup', 'Product'])}
messages={pick(messages, ['FacetedGroup', 'Product'])}
>
<div className="md:mb-8 lg:flex lg:flex-row lg:items-center lg:justify-between">
<h1 className="mb-4 text-4xl font-black lg:mb-0 lg:text-5xl">{category.name}</h1>
Expand Down
4 changes: 2 additions & 2 deletions apps/core/app/[locale]/(default)/(faceted)/search/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default async function Search({ params: { locale }, searchParams }: Props
const t = await getTranslations('Search');
const tPagination = await getTranslations({ locale, namespace: 'Pagination' });

const dictionary = await getMessages({ locale });
const messages = await getMessages({ locale });
const searchTerm = typeof searchParams.term === 'string' ? searchParams.term : undefined;

if (!searchTerm) {
Expand Down Expand Up @@ -63,7 +63,7 @@ export default async function Search({ params: { locale }, searchParams }: Props
<div>
<NextIntlClientProvider
locale={locale}
messages={pick(dictionary, ['FacetedGroup', 'Product'])}
messages={pick(messages, ['FacetedGroup', 'Product'])}
>
<div className="md:mb-8 lg:flex lg:flex-row lg:items-center lg:justify-between">
<h1 className="mb-3 text-base">
Expand Down
4 changes: 2 additions & 2 deletions apps/core/app/[locale]/(default)/(webpages)/[page]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default async function WebPage({ params: { locale, page } }: Props) {
notFound();
}

const dictionary = await getMessages({ locale });
const messages = await getMessages({ locale });
const { name, htmlBody, __typename: pageType, entityId } = webpage;

switch (pageType) {
Expand All @@ -49,7 +49,7 @@ export default async function WebPage({ params: { locale, page } }: Props) {
return (
<>
<PageContent content={htmlBody} title={name} />
<NextIntlClientProvider locale={locale} messages={pick(dictionary, 'AboutUs')}>
<NextIntlClientProvider locale={locale} messages={pick(messages, 'AboutUs')}>
<ContactUs
fields={webpage.contactFields}
pageEntityId={entityId}
Expand Down
4 changes: 2 additions & 2 deletions apps/core/app/[locale]/(default)/cart/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ interface Props {

export default async function CartPage({ params: { locale } }: Props) {
const t = await getTranslations({ locale, namespace: 'Cart' });
const dictionary = await getMessages({ locale });
const messages = await getMessages({ locale });
const cartId = cookies().get('cartId')?.value;
const shippingCostData = cookies().get('shippingCosts')?.value;
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
Expand Down Expand Up @@ -182,7 +182,7 @@ export default async function CartPage({ params: { locale } }: Props) {
</ul>

<div className="col-span-1 col-start-2 lg:col-start-3">
<NextIntlClientProvider locale={locale} messages={pick(dictionary, 'Cart')}>
<NextIntlClientProvider locale={locale} messages={pick(messages, 'Cart')}>
<CheckoutSummary
cart={cart}
key={cart.totalExtendedListPrice.value}
Expand Down
8 changes: 4 additions & 4 deletions apps/core/app/[locale]/(default)/compare/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default async function Compare({
params: { locale: LocaleType };
}) {
const t = await getTranslations({ locale, namespace: 'Compare' });
const dictionary = await getMessages({ locale });
const messages = await getMessages({ locale });

const parsed = CompareParamsSchema.parse(searchParams);
const productIds = parsed.ids?.filter((id) => !Number.isNaN(id));
Expand All @@ -61,7 +61,7 @@ export default async function Compare({
<div className="flex max-w-2xl flex-col gap-8 pb-8">
<h1 className="text-4xl font-black lg:text-5xl">{t('nothingCompare')}</h1>
<p className="text-lg">{t('helpingText')}</p>
<NextIntlClientProvider locale={locale} messages={pick(dictionary, 'NotFound')}>
<NextIntlClientProvider locale={locale} messages={pick(messages, 'NotFound')}>
<SearchForm />
</NextIntlClientProvider>
</div>
Expand Down Expand Up @@ -155,7 +155,7 @@ export default async function Compare({

return (
<td className="border-b px-4 pb-12" key={product.entityId}>
<NextIntlClientProvider locale={locale} messages={pick(dictionary, 'Compare')}>
<NextIntlClientProvider locale={locale} messages={pick(messages, 'Compare')}>
<AddToCartForm
availability={product.availabilityV2.status}
entityId={product.entityId}
Expand Down Expand Up @@ -243,7 +243,7 @@ export default async function Compare({

return (
<td className="border-b px-4 pb-24 pt-12" key={product.entityId}>
<NextIntlClientProvider locale={locale} messages={pick(dictionary, 'Compare')}>
<NextIntlClientProvider locale={locale} messages={pick(messages, 'Compare')}>
<AddToCartForm
availability={product.availabilityV2.status}
entityId={product.entityId}
Expand Down
4 changes: 2 additions & 2 deletions apps/core/app/[locale]/(default)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface Props extends PropsWithChildren {
export default function DefaultLayout({ children, params: { locale } }: Props) {
unstable_setRequestLocale(locale);

const dictionary = useMessages();
const messages = useMessages();

return (
<>
Expand All @@ -25,7 +25,7 @@ export default function DefaultLayout({ children, params: { locale } }: Props) {
{children}
</main>
<Suspense fallback={null}>
<NextIntlClientProvider locale={locale} messages={pick(dictionary, 'Product')}>
<NextIntlClientProvider locale={locale} messages={pick(messages, 'Product')}>
<ProductSheet />
</NextIntlClientProvider>
</Suspense>
Expand Down
4 changes: 2 additions & 2 deletions apps/core/app/[locale]/(default)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default async function Home({ params: { locale } }: Props) {
unstable_setRequestLocale(locale);

const t = await getTranslations({ locale, namespace: 'Home' });
const dictionary = await getMessages({ locale });
const messages = await getMessages({ locale });
const [newestProducts, featuredProducts] = await Promise.all([
getNewestProducts({ imageWidth: 500, imageHeight: 500 }),
getFeaturedProducts({ imageWidth: 500, imageHeight: 500 }),
Expand All @@ -29,7 +29,7 @@ export default async function Home({ params: { locale } }: Props) {
<Hero />

<div className="my-10">
<NextIntlClientProvider locale={locale} messages={pick(dictionary, 'Product')}>
<NextIntlClientProvider locale={locale} messages={pick(messages, 'Product')}>
<ProductCardCarousel
products={featuredProducts}
showCart={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ProductCardCarousel } from '~/components/product-card-carousel';
export const RelatedProducts = async ({ productId }: { productId: number }) => {
const t = await getTranslations('Product');
const locale = await getLocale();
const dictionary = await getMessages({ locale });
const messages = await getMessages({ locale });

const relatedProducts = await getRelatedProducts({
productId,
Expand All @@ -17,7 +17,7 @@ export const RelatedProducts = async ({ productId }: { productId: number }) => {
});

return (
<NextIntlClientProvider locale={locale} messages={pick(dictionary, 'Product')}>
<NextIntlClientProvider locale={locale} messages={pick(messages, 'Product')}>
<ProductCardCarousel
products={relatedProducts}
showCart={false}
Expand Down
4 changes: 2 additions & 2 deletions apps/core/app/[locale]/(default)/product/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default async function Product({ params, searchParams }: ProductPageProps
unstable_setRequestLocale(locale);

const t = await getTranslations({ locale, namespace: 'Product' });
const dictionary = await getMessages({ locale });
const messages = await getMessages({ locale });

const productId = Number(params.slug);
const { slug, ...options } = searchParams;
Expand All @@ -79,7 +79,7 @@ export default async function Product({ params, searchParams }: ProductPageProps
<>
<BreadCrumbs productId={product.entityId} />
<div className="mb-12 mt-4 lg:grid lg:grid-cols-2 lg:gap-8">
<NextIntlClientProvider locale={locale} messages={pick(dictionary, ['Product'])}>
<NextIntlClientProvider locale={locale} messages={pick(messages, ['Product'])}>
<Gallery noImageText={t('noGalleryText')} product={product} />
<Details product={product} />
<div className="lg:col-span-2">
Expand Down
4 changes: 2 additions & 2 deletions apps/core/app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ export default function RootLayout({ children, params: { locale } }: RootLayoutP
// https://next-intl-docs.vercel.app/docs/getting-started/app-router#add-unstable_setrequestlocale-to-all-layouts-and-pages
unstable_setRequestLocale(locale);

const dictionary = useMessages();
const messages = useMessages();

return (
<html className={`${inter.variable} font-sans`} lang={locale}>
<body className="flex h-screen flex-col">
<Notifications />
<NextIntlClientProvider locale={locale} messages={pick(dictionary, 'Providers')}>
<NextIntlClientProvider locale={locale} messages={pick(messages, 'Providers')}>
<Providers>{children}</Providers>
</NextIntlClientProvider>
<Analytics />
Expand Down
6 changes: 3 additions & 3 deletions apps/core/app/[locale]/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const metadata = {
export default async function NotFound() {
const locale = await getLocale();
const t = await getTranslations('NotFound');
const dictionary = await getMessages({ locale });
const messages = await getMessages({ locale });

const featuredProducts = await getFeaturedProducts({
imageHeight: 500,
Expand All @@ -40,7 +40,7 @@ export default async function NotFound() {
<h2 className="text-4xl font-black lg:text-5xl">{t('heading')}</h2>
<p className="text-lg">{t('message')}</p>
</Message>
<NextIntlClientProvider locale={locale} messages={pick(dictionary, 'NotFound')}>
<NextIntlClientProvider locale={locale} messages={pick(messages, 'NotFound')}>
<SearchForm />
</NextIntlClientProvider>
<section>
Expand All @@ -50,7 +50,7 @@ export default async function NotFound() {
<NextIntlClientProvider
key={product.entityId}
locale={locale}
messages={pick(dictionary, 'Product')}
messages={pick(messages, 'Product')}
>
<ProductCard
product={product}
Expand Down
Loading

0 comments on commit a991549

Please sign in to comment.