یونified Frontend اور Mobile Translations API

یہ پلیٹ فارم ایک مشترکہ translation contract فراہم کرتا ہے جو Inertia pages اور mobile apps دونوں کے لیے کام کرتا ہے۔

Endpoint

  • GET /api/translations web/mobile clients کے لیے
  • GET /locale/translations authenticated web flows کے لیے

Query Parameters

  • locale: primary locale (example: en)
  • locales: multi-locale payloads کے لیے comma-separated locales (example: en,bn,ar)
  • namespaces: comma-separated namespaces (example: platformkit,accounting)
  • module یا modules: module name(s) سے namespaces infer کریں
  • path یا page: page route سے namespaces infer کریں (example: admin/system/accounting/reports)

Response کی شکل

{
  "locale": "en",
  "locales": ["en", "bn"],
  "namespaces": ["platformkit", "accounting"],
  "translations": { ...primary locale payload... },
  "translations_by_locale": {
    "en": { ... },
    "bn": { ... }
  }
}

Inertia اسے کیسے استعمال کرتا ہے

Inertia pages کو translation meta (locale + namespaces) ملتا ہے اور اصل translations اس سے lazy-load ہوتی ہیں /api/translations. Responses session storage میں cache ہوتی ہیں تاکہ بار بار آنے والی requests کم ہوں۔

Mobile اسے کیسے استعمال کرتا ہے

Mobile apps ایک ہی request میں تمام ضروری namespaces اور locales طلب کر سکتی ہیں، پھر انہیں cache کرتی ہیں translations_by_locale offline اور تیز screen rendering کے لیے locally۔

Best Practices

  • ہر screen/module کے لیے صرف ضروری namespaces طلب کریں۔
  • استعمال کریں locales جب app boot time پر language packs preload کیے جا رہے ہوں۔
  • اس پر fallback کریں en جب کوئی locale file موجود نہ ہو تو یہ خودکار ہوتا ہے۔
آخری اپ ڈیٹ: 11/21/2026