Skip to content

Translations (Public)

Public endpoints for consuming translations. No authentication required. These endpoints are intended for frontend applications.

Base path: /api/v1/translations


Get All Translations

Returns all published translations for a language in a nested JSON format compatible with i18next.

GET /api/v1/translations/{language_code}

Authentication: Not required

Path parameters

Parameter Type Description
language_code string Language code e.g. en, sr

Response 200 OK

{
  "language": "en",
  "translations": {
    "common": {
      "btn": {
        "save": "Save changes",
        "cancel": "Cancel",
        "delete": "Delete"
      },
      "label": {
        "loading": "Loading..."
      }
    },
    "nav": {
      "main": {
        "home": "Home",
        "about": "About",
        "contact": "Contact"
      }
    },
    "pages": {
      "home": {
        "title": "Welcome",
        "subtitle": "Glad to have you here"
      }
    }
  }
}

Errors

Status Description
404 Language not found

Get Translations by Namespace

Returns published translations for a specific namespace only. Useful for lazy-loading translations on the frontend.

GET /api/v1/translations/{language_code}/{namespace}

Authentication: Not required

Path parameters

Parameter Type Description
language_code string Language code e.g. en, sr
namespace string Namespace e.g. common, nav

Response 200 OK

{
  "language": "en",
  "translations": {
    "common": {
      "btn": {
        "save": "Save changes",
        "cancel": "Cancel"
      }
    }
  }
}

Errors

Status Description
404 Language not found

i18next Integration

The response format is directly compatible with i18next. Example frontend setup:

import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';

const response = await fetch('/api/v1/translations/en');
const { translations } = await response.json();

i18n.use(initReactI18next).init({
  resources: {
    en: translations
  },
  lng: 'en',
  fallbackLng: 'en',
});