Skip to content

Commit

Permalink
Merge pull request #67 from commercelayer/add-locale-hu
Browse files Browse the repository at this point in the history
Add Hungarian translations
  • Loading branch information
gciotola authored Apr 11, 2024
2 parents 5aa1ee4 + 1faae43 commit 97abb3d
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/cart/@typing/react-i18next.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "react-i18next"
import commonEn from "#assets/locales/en/common.json"

declare module "react-i18next" {
export type AllowedLocaleKeys = "en" | "it" | "de" | "pl"
export type AllowedLocaleKeys = "en" | "it" | "de" | "pl" | "hu"

type AppResources = {
common: typeof commonEn
Expand Down
51 changes: 51 additions & 0 deletions packages/cart/src/assets/locales/hu/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"general": {
"title": "Kosár",
"item": "elem",
"item_other": "elemek",
"emptyCart": "Az ön kosara üres",
"remove": "Eltávolítás",
"price": "Ár",
"finalPriceInCheckoutText": "Adóval, a szállítási költség kiszámítása a fizetésnél történik",
"subtotal": "Részösszeg",
"discount": "Kedvezmény",
"giftCard": "Ajándékkártya",
"total": "Összesen",
"gotToCheckoutCta": "Pénztárhoz",
"returnUrlLabel": "Vásárlás folytatása",
"quantityNotAvailable": "A kiválasztott mennyiség nem elérhető",
"retryableErrorCode": "Kapcsolódási hibák",
"retryableErrorDescription": "Próbálja meg újratölteni az oldalt"
},
"item": {
"frequency": {
"hourly": "Óránként",
"daily": "Naponta",
"weekly": "Hetente",
"monthly": "Havonta",
"two-months": "Kéthavonta",
"two-month": "Kéthavonta",
"three-months": "Háromhavonta",
"three-month": "Háromhavonta",
"four-months": "Négyhavonta",
"four-month": "Négyhavonta",
"six-months": "Félévente",
"six-month": "Félévente",
"yearly": "Évente"
}
},
"couponOrGift": {
"label": "Rendelkezik promóciós kóddal?",
"submit": "Elküldés",
"placeholder": {
"gift_card_or_coupon_code": "Ajándékkártya vagy kuponkód",
"gift_card_code": "Ajándékkártya",
"coupon_code": "Kuponkód"
},
"error": {
"gift_card_or_coupon_code": "Kérem adjon meg egy érvényes ajándékkártyát vagy kuponkódot",
"gift_card_code": "Kérem adjon meg egy érvényes ajándékkártyát",
"coupon_code": "Kérem adjon meg egy érvényes kupont"
}
}
}
4 changes: 4 additions & 0 deletions packages/cart/src/components/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {

import commonDe from "#assets/locales/de/common.json"
import commonEn from "#assets/locales/en/common.json"
import commonHu from "#assets/locales/hu/common.json"
import commonIt from "#assets/locales/it/common.json"
import commonPl from "#assets/locales/pl/common.json"

Expand All @@ -23,6 +24,9 @@ const resources: Record<AllowedLocaleKeys, AppResources> = {
pl: {
common: commonPl,
},
hu: {
common: commonHu,
},
}

use(initReactI18next).init({
Expand Down
3 changes: 2 additions & 1 deletion packages/cart/src/components/i18n/parseLanguageCode.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { AllowedLocaleKeys } from "react-i18next"

type ApiLanguageCode = "en" | "it" | "de" | "pl"
type ApiLanguageCode = "en" | "it" | "de" | "pl" | "hu"

const langs: Record<ApiLanguageCode, AllowedLocaleKeys> = {
en: "en",
it: "it",
de: "de",
pl: "pl",
hu: "hu",
}

export const parseLanguageCode = (apiLanguageCode: string) =>
Expand Down

0 comments on commit 97abb3d

Please sign in to comment.