-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from fe-may23-dreamTeam/localization-jsons
Localization jsons
- Loading branch information
Showing
20 changed files
with
372 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React, { useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { FiGlobe } from 'react-icons/fi'; | ||
|
||
const LanguageSelector = () => { | ||
const { i18n } = useTranslation(); | ||
const [isMenuOpen, setIsMenuOpen] = useState(false); | ||
|
||
const toggleMenu = () => { | ||
setIsMenuOpen(!isMenuOpen); | ||
}; | ||
|
||
const changeLanguage = (language: string | undefined) => { | ||
i18n.changeLanguage(language); | ||
setIsMenuOpen(false); | ||
}; | ||
|
||
const languageCodes = ['en', 'uk', 'ja']; | ||
|
||
return ( | ||
<div | ||
onClick={toggleMenu} | ||
className="cursor-pointer relative hover:shadow-lg dark:hover:shadow-custom-dark duration-200 p-4 tablet:p-6 flex border-x border-elements-light dark:border-elements-dark" | ||
> | ||
<button | ||
type="button" | ||
className="text-sm font-semibold text-gray-900 dark:text-white-light items-center justify-center h-4 w-4" | ||
> | ||
<FiGlobe className="h-4 w-4" /> | ||
</button> | ||
{isMenuOpen && ( | ||
<div className="absolute left-0 mt-9 tablet:mt-11 flex justify-center mb-2"> | ||
<div className="flex border rounded-lg shadow-md desktop:flex-col flex-row"> | ||
{languageCodes.map((code, index) => ( | ||
<button | ||
key={index} | ||
onClick={() => changeLanguage(code)} | ||
className={`px-3 py-1 tablet:px-4 tablet:py-2 desktop:px-7 text-sm text-gray-900 text-center dark:text-white-light`} | ||
> | ||
{code.toUpperCase()} | ||
</button> | ||
))} | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default LanguageSelector; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import i18n from 'i18next'; | ||
import { initReactI18next } from 'react-i18next'; | ||
|
||
import translationEN from './locales/en.json'; | ||
import translationUK from './locales/uk.json'; | ||
import translationJA from './locales/ja.json'; | ||
|
||
i18n.use(initReactI18next).init({ | ||
resources: { | ||
en: { | ||
translation: translationEN, | ||
}, | ||
uk: { | ||
translation: translationUK, | ||
}, | ||
ja: { | ||
translation: translationJA, | ||
}, | ||
}, | ||
lng: 'en', | ||
fallbackLng: 'en', | ||
interpolation: { | ||
escapeValue: false, | ||
}, | ||
}); | ||
|
||
export default i18n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
{ | ||
"home": "Home", | ||
"phones": "Phones", | ||
"tablets": "Tablets", | ||
"accessories": "Accessories", | ||
"title": "Welcome to Nice Gadgets store!", | ||
"newModels": "Brand new models", | ||
"addToCart": "Add to cart", | ||
"toTheCart": "Successfully added to your cart!", | ||
"toTheCartError": "This product is already in your cart", | ||
"addedToCart": "Added to cart", | ||
"shopByCategory": "Shop by category", | ||
"mobilePhones": "Mobile phones", | ||
"hotPrices": "Hot prices", | ||
"contacts": "Contacts", | ||
"rights": "Rights", | ||
"backToTop": "Back to top", | ||
"model": "model", | ||
"modeli": "models", | ||
"models": "models", | ||
"sortBy": "Sort by", | ||
"newest": "Newest", | ||
"oldest": "Oldest", | ||
"itemsOnPage": "Items on page", | ||
"runOutOfProducts": "Sorry, we ran out of these products", | ||
"back": "Back", | ||
"availableColors": "Available colors", | ||
"selectCapacity": "Select capacity", | ||
"about": "About", | ||
"techSpecs": "Tech specs", | ||
"recomended": "Recomended", | ||
"favourites": "Favourites", | ||
"noFavourites": "You don't have favourite products", | ||
"cart": "Cart", | ||
"emptyCart": "Your cart is empty", | ||
"startShopping": "Start shopping now!", | ||
"totalFor": "Total for", | ||
"item": "item", | ||
"itemu": "items", | ||
"items": "items", | ||
"checkout": "Checkout", | ||
"successfulPayment": "Your payment was successfull", | ||
"thanksForOrder": "Thank you for shopping with us!", | ||
"orderPlaced": "Your order has been placed", | ||
"backHome": "Back to Home", | ||
"pageNotFound": "Page not found", | ||
"movedOrDeleted": "Most likely, this page has been moved or deleted", | ||
"addressMistake": "You may have made a mistake when entering the address", | ||
"checkAgain": "Please check it again", | ||
"takeMeHome": "Take me home", | ||
"contactSupport": "Contact support", | ||
"ourTeam": "Our Team", | ||
"language": "Language" | ||
} |
Oops, something went wrong.