Zephora UI

स्थानीयकरण

हर बिल्ट-इन UI स्ट्रिंग (क्लोज़ बटन, pagination लेबल, सॉर्ट घोषणाएँ, अपलोड प्रॉम्प्ट…) 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 बदलें — pagination लेबल और 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
azAzərbaycanca (Azerbaijani)@zephora/theme/locales/az
bgБългарски (Bulgarian)@zephora/theme/locales/bg
bnবাংলা (Bengali)@zephora/theme/locales/bn
caCatalà (Catalan)@zephora/theme/locales/ca
csČeština (Czech)@zephora/theme/locales/cs
daDansk (Danish)@zephora/theme/locales/da
deDeutsch (German)@zephora/theme/locales/de
elΕλληνικά (Greek)@zephora/theme/locales/el
esEspañol (Spanish)@zephora/theme/locales/es
etEesti (Estonian)@zephora/theme/locales/et
faفارسی (Persian)@zephora/theme/locales/fa
fiSuomi (Finnish)@zephora/theme/locales/fi
frFrançais (French)@zephora/theme/locales/fr
heעברית (Hebrew)@zephora/theme/locales/he
hiहिन्दी (Hindi)@zephora/theme/locales/hi
hrHrvatski (Croatian)@zephora/theme/locales/hr
huMagyar (Hungarian)@zephora/theme/locales/hu
hyՀայերեն (Armenian)@zephora/theme/locales/hy
idBahasa Indonesia (Indonesian)@zephora/theme/locales/id
isÍslenska (Icelandic)@zephora/theme/locales/is
itItaliano (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
ltLietuvių (Lithuanian)@zephora/theme/locales/lt
lvLatviešu (Latvian)@zephora/theme/locales/lv
msBahasa Melayu (Malay)@zephora/theme/locales/ms
nlNederlands (Dutch)@zephora/theme/locales/nl
noNorsk bokmål (Norwegian)@zephora/theme/locales/no
plPolski (Polish)@zephora/theme/locales/pl
ptPortuguês (Portuguese)@zephora/theme/locales/pt
pt-brPortuguês do Brasil (Brazilian Portuguese)@zephora/theme/locales/pt-br
roRomână (Romanian)@zephora/theme/locales/ro
ruРусский (Russian)@zephora/theme/locales/ru
skSlovenčina (Slovak)@zephora/theme/locales/sk
slSlovenščina (Slovenian)@zephora/theme/locales/sl
srSrpski (Serbian)@zephora/theme/locales/sr
svSvenska (Swedish)@zephora/theme/locales/sv
swKiswahili (Swahili)@zephora/theme/locales/sw
taதமிழ் (Tamil)@zephora/theme/locales/ta
thไทย (Thai)@zephora/theme/locales/th
trTürkçe (Turkish)@zephora/theme/locales/tr
ukУкраїнська (Ukrainian)@zephora/theme/locales/uk
viTiế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

संदेश संदर्भ

पूरा key सेट ZephoraLocale टाइप पर रहता है — क्रियाएँ (close, cancel, confirm, clear…), डेटा स्थितियाँ (loading, noData, emptyMessage), फ़ॉर्म स्ट्रिंग (showPassword, browseFiles, removeFile), नेविगेशन (pageOf, nextPage, breadcrumb), डेटा प्रदर्शन (sortAscending, selectAllRows, goToSlide) और तारीख़ें (prevMonth, chooseDate, firstDayOfWeek, intlLocale)। प्लेसहोल्डर {param} सिंटैक्स का उपयोग करते हैं जिसे t(key, params) इंटरपोलेट करता है।