LocalizerX

Seamless Integrations

LocalizerX works perfectly with your existing tech stack. From Laravel backend to modern frontend frameworks and beyond.

Laravel
Vue.js
React
Shopify

🌐 Global Integration Guide for LocalizerX

Overview

  • LocalizerX provides a RESTful API that returns translation data as JSON.
  • You can use the JSON response directly in any framework or platform.
  • There are no SDK restrictions — integrate with Laravel, React, Vue, Next.js, or Node.js.

API Endpoint

  • Base URL: https://localizerx.test/api/translations?language={locale}
  • Example Response:
    {
          "auth.login": "Dolor quam ducimus",
          "auth.logout": "Logout"
        }

Integration Concept

  • Your backend or frontend app fetches translations from LocalizerX.
  • The API returns a JSON object containing key-value pairs.
  • You can load, cache, or merge this JSON as you wish.
  • Display text using any i18n library like vue-i18n, i18next, or Laravel’s __('key').

Framework-Specific Setup

  • Laravel: Extend the translation loader and merge API responses with local translations.
  • Vue 3: Use vue-i18n, fetch translations, and cache in localStorage.
  • React: Use i18next to load dynamic translations and switch languages in real-time.
  • Node.js: Fetch JSON once on startup and cache in memory or Redis.

Example Usage

fetch('https://localizerx.test/api/translations?language=en')
      .then(res => res.json())
      .then(data => console.log(data['auth.login']))
OutputDolor quam ducimus

Supported Frameworks

Laravel Vue 3 React Next.js Node.js

Important Note

  • LocalizerX only returns JSON data.
  • You are free to use, cache, or render the JSON however your project requires.

Framework Integrations

Drop-in integrations for your favorite frameworks with minimal setup and maximum flexibility.

Laravel Backend

Seamlessly integrate LocalizerX with your Laravel application. Load translations dynamically from the LocalizerX API — no need to manage static language files manually.

Dynamic API Integration PHP
namespace App\Translation;
use Illuminate\Translation\FileLoader;
use Illuminate\Support\Facades\Http;

# make this file app/Translation/ApiLoader.php

class ApiLoader extends FileLoader {
  public function load($locale, $group, $namespace = null) {
    $lines = parent::load($locale, $group, $namespace);
    $remote = cache()->remember("translations_{$locale}", 3600, function () use ($locale) {
      return Http::get('https://yourdomain.com/api/translations', ['language' => $locale])->json();
    });
    return array_merge($lines, $remote ?? []);
  }
}

# make this file app/Providers/TranslationServiceProvider.php

$this->app->extend('translation.loader', function ($loader, $app) {
  return new \App\Translation\ApiLoader(
    new \Illuminate\Filesystem\Filesystem,
    $app['path.lang'],
    'https://yourdomain.com/api/translations'
  );
});

# If your Laravel version is below 11, register the service provider in config/app.php
# For Laravel 12 and above, register it in bootstrap/providers.php

App\Providers\TranslationServiceProvider::class,

# Usage in Blade or controllers
__('auth.login'); # → "Dolor quam ducimus"
__('auth.logout'); # → "Logout"

Caching ensures your app stays fast and reliable — translations are refreshed automatically every hour. Falls back to local files if the API is unavailable.

Laravel 10+ PHP 8.1+ Dynamic Translations API Powered

Vue.js Frontend

Reactive translations with Vue composables and automatic language switching.

Vue 3 Composition API JavaScript

# ==============================================
# 🎯 Vue 3 + vue-i18n Integration with Laravel API
# ==============================================

# STEP 1: Install dependencies
# ----------------------------------------------
# npm install vue-i18n@9


# STEP 2: Create src/plugins/i18n.js
# ----------------------------------------------
import { createI18n } from 'vue-i18n'

export const i18n = createI18n({
    legacy: false,          # Use Composition API style
    locale: 'en',           # Default language
    fallbackLocale: 'en',
    messages: {},           # Will be loaded dynamically
})


# STEP 3: Create src/utils/loadTranslations.js
# ----------------------------------------------
export async function loadTranslations(locale) {
    try {
        const response = await fetch(`https://localizerx.test/api/translations?language=${locale}`)
        if (!response.ok) throw new Error('Failed to fetch translations')

        const messages = await response.json()

        # Optional: Cache for faster reloads
        localStorage.setItem(`translations_${locale}`, JSON.stringify(messages))

        return messages
    } catch (error) {
        console.error('Translation API Error:', error)
        return {}
    }
}


# STEP 4: Initialize in src/main.js
# ----------------------------------------------
import { createApp } from 'vue'
import App from './App.vue'
import { i18n } from './plugins/i18n'
import { loadTranslations } from './utils/loadTranslations'

async function bootstrap() {
    # 1️⃣ Load translations from Laravel API
    const messages = await loadTranslations('en')

    # 2️⃣ Register them to vue-i18n
    i18n.global.setLocaleMessage('en', messages)

    # 3️⃣ Create and mount the app
    const app = createApp(App)
    app.use(i18n)
    app.mount('#app')
}

bootstrap()


# STEP 5: Use in a Vue Component (e.g. App.vue)
# ----------------------------------------------
<template>
<div class="p-6">
<h2>{{ $t('auth.login') }}</h2>
<p>{{ $t('auth.logout') }}</p>

<div class="space-x-4 mt-4">
<button @click="switchLanguage('en')" class="bg-blue-600 text-white px-3 py-1 rounded">English</button>
<button @click="switchLanguage('es')" class="bg-green-600 text-white px-3 py-1 rounded">Español</button>
</div>
</div>
</template>




# STEP 6: Optional LocalStorage Caching
# ----------------------------------------------
# Modify loadTranslations.js like this:

export async function loadTranslations(locale) {
    const cached = localStorage.getItem(`translations_${locale}`)
    if (cached) return JSON.parse(cached)

    const response = await fetch(`https://localizerx.test/api/translations?language=${locale}`)
    const messages = await response.json()

    localStorage.setItem(`translations_${locale}`, JSON.stringify(messages))
    return messages
}


# STEP 7: Usage anywhere in Vue
# ----------------------------------------------
# 

{{ $t('auth.login') }}

#

{{ $t('auth.logout') }}

Vue 3 Composition API TypeScript

React.js Integration

React hooks and context providers for seamless translation management.

React Hooks JSX

# ==============================================
# ⚛️ React + i18next Integration with Laravel API
# ==============================================

# STEP 1: Install dependencies
# ----------------------------------------------
# npm install i18next react-i18next


# STEP 2: Create src/i18n.js
# ----------------------------------------------
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'

# Initialize i18next with no default messages yet
i18n
.use(initReactI18next)
.init({
    lng: 'en',                  # Default language
    fallbackLng: 'en',
    interpolation: {
        escapeValue: false,       # React already escapes values
    },
    resources: {},              # We'll load from Laravel API dynamically
})

export default i18n


# STEP 3: Create src/utils/loadTranslations.js
# ----------------------------------------------
export async function loadTranslations(locale) {
    try {
        const response = await fetch(`https://localizerx.test/api/translations?language=${locale}`)
        if (!response.ok) throw new Error('Failed to fetch translations')

        const messages = await response.json()

        # Optional: cache for performance
        localStorage.setItem(`translations_${locale}`, JSON.stringify(messages))

        return messages
    } catch (error) {
        console.error('Translation API Error:', error)
        return {}
    }
}


# STEP 4: Initialize translations before rendering app
# ----------------------------------------------
import React from 'react'
import ReactDOM from 'react-dom/client'
import App from './App'
import i18n from './i18n'
import { I18nextProvider } from 'react-i18next'
import { loadTranslations } from './utils/loadTranslations'

async function bootstrap() {
    const messages = await loadTranslations('en')

    i18n.addResources('en', 'translation', messages)

    ReactDOM.createRoot(document.getElementById('root')).render(
        <React.StrictMode>
        <I18nextProvider i18n={i18n}>
        <App />
        </I18nextProvider>
        </React.StrictMode>
    )
}

bootstrap()


# STEP 5: Use translations inside components
# ----------------------------------------------
import React from 'react'
import { useTranslation } from 'react-i18next'

export default function Example() {
    const { t, i18n } = useTranslation()

    const switchLanguage = async (lang) => {
        const response = await fetch(`https://localizerx.test/api/translations?language=${lang}`)
        const messages = await response.json()
        i18n.addResources(lang, 'translation', messages)
        i18n.changeLanguage(lang)
    }

    return (
        <div className="p-6">
            <h2>{t('auth.login')}</h2>
            <p>{t('auth.logout')}</p>

            <div className="space-x-4 mt-4">
                <button onClick={() => switchLanguage('en')} className="bg-blue-600 text-white px-3 py-1 rounded">
                    English
                </button>
                <button onClick={() => switchLanguage('es')} className="bg-green-600 text-white px-3 py-1 rounded">
                    Español
                </button>
            </div>
        </div>
    )
}


# STEP 6: Optional - Auto detect browser language
# ----------------------------------------------
import i18nextBrowserLanguageDetector from 'i18next-browser-languagedetector'

# Add this before .init()
i18n
.use(i18nextBrowserLanguageDetector)
.use(initReactI18next)
.init({
    fallbackLng: 'en',
    resources: {},
})

# i18next will auto-detect the user's browser language


# STEP 7: Usage anywhere in React
# ----------------------------------------------
# import { useTranslation } from 'react-i18next'
# const { t } = useTranslation()
# 

{t('auth.login')}

#

{t('auth.logout')}

React 18 TypeScript Next.js

RESTful API Integration

Powerful REST API for custom integrations and headless implementations

API Endpoints

REST API v1

Get Translations

GET YOUR_ROOT_DOMAIN/api/translations?language=en&namespace=auth

Here namespace is optional

{
    "auth.login": "Login",
    "auth.register": "Register",
    "auth.forgot_password": "Forgot Password"
}

Platform Support

Works with all major platforms and deployment environments

Databases

  • MySQL 8.0+
  • PostgreSQL 13+
  • SQLite 3.x
  • MariaDB 10.x

Cache Drivers

  • Redis (recommended)
  • Memcached
  • File cache
  • Database cache

Cloud Platforms

  • AWS
  • Google Cloud
  • DigitalOcean
  • Laravel Forge

Hosting

  • Shared hosting
  • VPS
  • Dedicated servers
  • Docker containers

Real-World Examples

See how LocalizerX integrates in production applications

E-commerce Platform

Multi-language Shopify store with dynamic product translations

  • Product catalogs
  • Checkout process
  • Customer support
  • Email notifications

SaaS Application

Vue.js dashboard with real-time translation switching

  • User interface
  • Documentation
  • Help system
  • Onboarding flow

CMS Platform

React-based content management with multilingual support

  • Content editing
  • Media management
  • User permissions
  • Publishing workflow

Ready to Go Global?

Join hundreds of teams already transforming their products with LocalizerX.

Save time, reduce complexity, and reach global audiences faster.

Easy Installation • Instant Translate • Lifetime updates