স্থানীয়করণ
প্রতিটি বিল্ট-ইন UI স্ট্রিং (ক্লোজ বাটন, পেজিনেশন লেবেল, সর্টিং ঘোষণা, আপলোড প্রম্পট…) locale রেজিস্ট্রির মধ্য দিয়ে সমাধান হয়। বান্ডলে কেবল en এমবেড করা থাকে — অন্য প্রতিটি ভাষা বাইরে থেকে (ইম্পোর্টযোগ্য মডিউল বা JSON ফাইল) লোড হয় এবং addLocale দিয়ে নিবন্ধিত হয়। একই রেজিস্ট্রি @zephora/react ও @zephora/native উভয়কে চালায়। en, tr.
একটি locale লোড করা
// 1) As a module (tree-shaken, typed):
import { addLocale } from "@zephora/react";
import { trLocale } from "@zephora/theme/locales/tr";
addLocale("tr", trLocale);
// 2) As JSON over the network (e.g. from your CDN):
const messages = await fetch("/locales/tr.json").then((r) => r.json());
addLocale("tr", messages);
// JSON dosyası pakette hazır: @zephora/theme/locales/tr.jsonলাইভ ডেমো
locale পরিবর্তন করুন — পেজিনেশন লেবেল এবং dialog বাটন সঙ্গে সঙ্গে আপডেট হয়।
একটি locale নির্বাচন
// Web
<ZephoraConfigProvider locale="tr">...</ZephoraConfigProvider>
// React Native
<ZephoraProvider theme={lightTheme} locale="tr">...</ZephoraProvider>একটি কাস্টম locale নিবন্ধন
addLocale আপনার বার্তাগুলোকে ইংরেজির উপর মার্জ করে, তাই আংশিক সংজ্ঞা নিরাপদ। updateLocale বিদ্যমান একটিকে প্যাচ করে।
import { addLocale, updateLocale } from "@zephora/react";
addLocale("de", {
intlLocale: "de",
firstDayOfWeek: 1,
close: "Schließen",
cancel: "Abbrechen",
confirm: "Bestätigen",
loading: "Wird geladen…",
pageOf: "Seite {page} von {count}",
});
updateLocale("de", { clear: "Leeren" });নিজের কম্পোনেন্টে স্ট্রিং পড়া
import { useLocale, localeOption } from "@zephora/react";
function SaveBar() {
const { t } = useLocale();
return <Button>{t("apply")}</Button>;
}
// Outside React:
localeOption("cancel", "tr"); // "İptal"উপলব্ধ locale
48টি তৈরি অনুবাদসহ আসে। প্রতিটি একটি স্বাধীন মডিউল — শুধু যা দরকার তা-ই ইম্পোর্ট করুন (বা মিলে যাওয়া .json fetch করুন)।
| কোড | ভাষা | ইম্পোর্ট পাথ |
|---|---|---|
ar | العربية (Arabic) | @zephora/theme/locales/ar |
az | Azərbaycanca (Azerbaijani) | @zephora/theme/locales/az |
bg | Български (Bulgarian) | @zephora/theme/locales/bg |
bn | বাংলা (Bengali) | @zephora/theme/locales/bn |
ca | Català (Catalan) | @zephora/theme/locales/ca |
cs | Čeština (Czech) | @zephora/theme/locales/cs |
da | Dansk (Danish) | @zephora/theme/locales/da |
de | Deutsch (German) | @zephora/theme/locales/de |
el | Ελληνικά (Greek) | @zephora/theme/locales/el |
es | Español (Spanish) | @zephora/theme/locales/es |
et | Eesti (Estonian) | @zephora/theme/locales/et |
fa | فارسی (Persian) | @zephora/theme/locales/fa |
fi | Suomi (Finnish) | @zephora/theme/locales/fi |
fr | Français (French) | @zephora/theme/locales/fr |
he | עברית (Hebrew) | @zephora/theme/locales/he |
hi | हिन्दी (Hindi) | @zephora/theme/locales/hi |
hr | Hrvatski (Croatian) | @zephora/theme/locales/hr |
hu | Magyar (Hungarian) | @zephora/theme/locales/hu |
hy | Հայերեն (Armenian) | @zephora/theme/locales/hy |
id | Bahasa Indonesia (Indonesian) | @zephora/theme/locales/id |
is | Íslenska (Icelandic) | @zephora/theme/locales/is |
it | Italiano (Italian) | @zephora/theme/locales/it |
ja | 日本語 (Japanese) | @zephora/theme/locales/ja |
ka | ქართული (Georgian) | @zephora/theme/locales/ka |
kk | Қазақша (Kazakh) | @zephora/theme/locales/kk |
ko | 한국어 (Korean) | @zephora/theme/locales/ko |
lt | Lietuvių (Lithuanian) | @zephora/theme/locales/lt |
lv | Latviešu (Latvian) | @zephora/theme/locales/lv |
ms | Bahasa Melayu (Malay) | @zephora/theme/locales/ms |
nl | Nederlands (Dutch) | @zephora/theme/locales/nl |
no | Norsk bokmål (Norwegian) | @zephora/theme/locales/no |
pl | Polski (Polish) | @zephora/theme/locales/pl |
pt | Português (Portuguese) | @zephora/theme/locales/pt |
pt-br | Português do Brasil (Brazilian Portuguese) | @zephora/theme/locales/pt-br |
ro | Română (Romanian) | @zephora/theme/locales/ro |
ru | Русский (Russian) | @zephora/theme/locales/ru |
sk | Slovenčina (Slovak) | @zephora/theme/locales/sk |
sl | Slovenščina (Slovenian) | @zephora/theme/locales/sl |
sr | Srpski (Serbian) | @zephora/theme/locales/sr |
sv | Svenska (Swedish) | @zephora/theme/locales/sv |
sw | Kiswahili (Swahili) | @zephora/theme/locales/sw |
ta | தமிழ் (Tamil) | @zephora/theme/locales/ta |
th | ไทย (Thai) | @zephora/theme/locales/th |
tr | Türkçe (Turkish) | @zephora/theme/locales/tr |
uk | Українська (Ukrainian) | @zephora/theme/locales/uk |
vi | Tiếng Việt (Vietnamese) | @zephora/theme/locales/vi |
zh-cn | 简体中文 (Simplified Chinese) | @zephora/theme/locales/zh-cn |
zh-tw | 繁體中文 (Traditional Chinese) | @zephora/theme/locales/zh-tw |
বার্তা রেফারেন্স
সম্পূর্ণ কী সেটটি ZephoraLocale টাইপে থাকে — অ্যাকশন (close, cancel, confirm, clear…), ডেটা অবস্থা (loading, noData, emptyMessage), ফর্ম স্ট্রিং (showPassword, browseFiles, removeFile), নেভিগেশন (pageOf, nextPage, breadcrumb), ডেটা প্রদর্শন (sortAscending, selectAllRows, goToSlide) এবং তারিখ (prevMonth, chooseDate, firstDayOfWeek, intlLocale)। প্লেসহোল্ডারগুলো t(key, params) দিয়ে ইন্টারপোলেট করা {param} সিনট্যাক্স ব্যবহার করে।