इसे छोड़कर कंटेंट पर जाएं

Internationalization

अपने app में multi-language support जोड़ें। editorial localization के लिए Proyecta Content API का उपयोग करें, या AI से सीधे code में i18n framework wire up करने के लिए कहें।

Proyecta आपके बनाए गए apps को internationalize करने के लिए दो complementary तरीके support करता है:

  1. Proyecta Content API के ज़रिए Content localization — editorial content (blog posts, FAQs, marketing copy) के लिए जिन्हें कई भाषाओं में translate करना हो
  2. Translation framework के ज़रिए Code-level i18n — UI strings, dates, currencies, और runtime locale switching के लिए

दोनों आज उपलब्ध हैं। आपको किसकी ज़रूरत है यह इस बात पर निर्भर करता है कि आप क्या translate कर रहे हैं।

Proyecta का builder खुद 24 locales के साथ आता है, इसलिए product i18n में पूरी तरह सक्षम है। यही patterns उन apps पर भी लागू होते हैं जो आप इसके अंदर बनाते हैं।

Option 1: Content localization (Proyecta Content API)

Section titled “Option 1: Content localization (Proyecta Content API)”

अगर आप content-heavy site बना रहे हैं — blog, knowledge base, marketing pages, product catalog — तो Content API की built-in locale support का उपयोग करें।

// Create the locales you support
await proyecta.content.locales.create({
/* code: 'en', name: 'English' */
});
await proyecta.content.locales.create({
/* code: 'es', name: 'Español' */
});
await proyecta.content.locales.create({
/* code: 'fr', name: 'Français' */
});
// Then create entries that exist in multiple locales — fetch the right
// translation per request based on the user's locale.

यह सही विकल्प है जब:

  • ऐसे editors जो code नहीं लिखते, उन्हें content translate करना हो
  • आप चाहते हों कि translations versionable हों
  • आपको locale-specific publishing चाहिए हो (scheduled publishing जल्द आ रहा है — entries को अभी API के ज़रिए manually publish करना होता है)

पूरे Content API के लिए Content Management देखें।

UI strings के लिए — labels, buttons, error messages, dates, currencies — AI से अपने project में सीधे i18n framework wire up करने के लिए कहें:

Add internationalization to my app.
Support English, Spanish, French, and Arabic.
Add message catalogs in src/locales/.
Add a language switcher in the header.
Use locale-prefixed URLs like /en/about and /es/about.
Make sure RTL layout works correctly for Arabic.

AI यह करेगा:

  1. Framework चुनेगा — AI i18next और react-i18next का उपयोग करता है (Proyecta का standard)
  2. Catalog files बनाएगा src/locales/ में (प्रत्येक भाषा के लिए एक JSON)
  3. Text को t() calls में wrap करेगा (react-i18next के useTranslation hook से)
  4. Language switcher component जोड़ेगा
  5. URL routing को locale prefixes के साथ wire करेगा
  6. RTL layouts (dir="rtl") को Arabic, Hebrew आदि के लिए handle करेगा
  7. Numbers, dates, और currencies को locale के अनुसार format करेगा

एक बार जब आपकी base language तैयार हो जाए, तो AI बाकी catalog files बनाने में बहुत काम आता है:

  • "Translate every string in src/locales/en.json into Spanish, French, German, and Japanese. Use natural, idiomatic phrasing — don't translate brand names."
  • "My app is fully built in English. Add Spanish translations for everything and an es/ route prefix."

high-stakes content (legal copy, medical, finance) के लिए, ship करने से पहले किसी human translator से AI का output review करवाएं।

दोनों approaches को combine करना

Section titled “दोनों approaches को combine करना”

ज़्यादातर real apps दोनों का उपयोग करती हैं: UI chrome (buttons, errors, navigation) के लिए code-level i18n, और editorial content (articles, product descriptions) के लिए Content API। ये cleanly साथ काम करते हैं — आपका i18n framework build time पर catalog files handle करता है, और Content API runtime पर localized entries serve करता है।

  1. पहले अपनी base language चुनें और copy finalize करें। बदलते target को translate करना कठिन होता है।
  2. Translations batch करें। चलते-चलते translate न करें — किसी feature के stable होने तक रुकें।
  3. RTL को जल्दी test करें अगर आप Arabic या Hebrew support करते हैं। RTL bugs तब तक छुपे रहते हैं जब तक आप ध्यान से देखते नहीं।
  4. <html> पर lang और dir ज़रूर शामिल करें। Browsers और screen readers इस पर निर्भर करते हैं।
  5. Formatting के लिए Intl का उपयोग करें। Date या currency formatting खुद से न बनाएं — Intl.DateTimeFormat, Intl.NumberFormat का उपयोग करें।
  • In-builder locale management UI — locales चुनें, translation coverage देखें, Proyecta छोड़े बिना catalogs edit करें
  • नई strings के लिए Auto-translate-on-save
  • i18n-ready project templates जिनमें framework पहले से wire हो