- Updated: March 21, 2026
- 6 min read
Localizing the OpenClaw Full‑Stack Template UI to Spanish: A Hands‑On Tutorial
You can localize the OpenClaw full‑stack template UI to Spanish by adding i18n support, creating Spanish translation files, and configuring runtime language switching.
1. Introduction
OpenClaw is a powerful full‑stack template that accelerates web‑app development with a clean architecture and ready‑made UI components. For developers targeting Spanish‑speaking markets, a seamless localization process is essential. This tutorial walks you through every step—from installing an internationalization (i18n) library to testing the final Spanish UI—so you can ship a polished, multilingual product faster.
While OpenClaw shines on its own, it also integrates smoothly with the broader UBOS platform overview, giving you access to a suite of AI‑enhanced services that can further streamline your workflow.
2. Prerequisites
- Node.js (v14 or later) and npm installed on your workstation.
- A cloned copy of the OpenClaw repository (or the latest release zip).
- Basic familiarity with React (or Vue, depending on your OpenClaw flavor).
- Access to the UBOS templates for quick start if you prefer a pre‑configured starter.
- Optional: An API key for OpenAI ChatGPT integration to auto‑generate translation strings.
Make sure your development environment can run npm run dev without errors before proceeding.
3. Adding i18n support to OpenClaw
OpenClaw does not ship with i18n out of the box, but adding it is straightforward thanks to popular libraries like react-i18next (for React) or vue-i18n (for Vue). Below we use React as the reference implementation.
Step‑by‑step installation
- Install the core i18n packages:
npm install i18next react-i18next i18next-browser-languagedetector - Create an
i18n.jsfile insrc/:import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; i18n .use(LanguageDetector) // Detects user language .use(initReactI18next) // Passes i18n down to react-i18next .init({ fallbackLng: 'en', debug: false, resources: { en: { translation: {} }, // Will be filled later es: { translation: {} }, }, interpolation: { escapeValue: false }, }); export default i18n; - Wrap your root component with the i18n provider. Edit
src/index.js:import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import './i18n'; // <-- import the i18n config ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.getElementById('root') );
With i18n wired into the app, you can now replace static strings with the t function provided by useTranslation. For example:
import { useTranslation } from 'react-i18next';
function Header() {
const { t } = useTranslation();
return <h1>{t('welcome_message')}</h1>;
}At this point, the UI will still display empty strings because we haven’t supplied any translation data. That’s the next step.
4. Creating Spanish translation files
OpenClaw stores translations in JSON files under src/locales/. Create the folder structure if it does not exist:
mkdir -p src/locales/en src/locales/esNext, add an en.json file with the default English strings:
{
"welcome_message": "Welcome to OpenClaw",
"login": "Login",
"logout": "Logout",
"dashboard": "Dashboard",
"settings": "Settings"
}Now create es.json for Spanish. You can manually translate each key, or leverage the OpenAI ChatGPT integration to generate high‑quality translations automatically.
Using ChatGPT for bulk translation
- Send the English JSON to the ChatGPT API with a prompt like: “Translate the following JSON keys to Spanish, preserving the JSON structure.”
- Copy the response into
src/locales/es.json.
Resulting es.json might look like this:
{
"welcome_message": "Bienvenido a OpenClaw",
"login": "Iniciar sesión",
"logout": "Cerrar sesión",
"dashboard": "Tablero",
"settings": "Configuración"
}Finally, import the translation files into i18n.js so they replace the empty objects we defined earlier:
import en from './locales/en.json';
import es from './locales/es.json';
i18n.init({
resources: {
en: { translation: en },
es: { translation: es },
},
// ...other options remain unchanged
});5. Switching language at runtime
End‑users need a UI control to toggle between English and Spanish. The simplest approach is a dropdown that calls i18n.changeLanguage. Below is a reusable LanguageSwitcher component.
import React from 'react';
import i18n from '../i18n';
export default function LanguageSwitcher() {
const changeLanguage = (lng) => {
i18n.changeLanguage(lng);
};
return (
<div className="flex space-x-2">
<button onClick={() => changeLanguage('en')} className="px-3 py-1 bg-gray-200 rounded">English</button>
<button onClick={() => changeLanguage('es')} className="px-3 py-1 bg-gray-200 rounded">Español</button>
</div>
);
}Place <LanguageSwitcher /> in your navigation bar or header. Because we used i18next-browser-languagedetector, the library will remember the user’s choice in localStorage and automatically apply it on subsequent visits.
If you need a more sophisticated workflow—such as persisting the language preference in a backend database—consider using the Workflow automation studio to trigger an API call whenever the language changes.
6. Testing the Spanish UI
Before releasing, verify that every UI string appears correctly in Spanish and that layout issues (e.g., longer text) are handled gracefully.
Manual testing checklist
- Navigate to every route and confirm translations appear.
- Check form validation messages for Spanish output.
- Resize the browser to ensure responsive design still works with longer strings.
- Use the browser’s dev tools to simulate a Spanish locale and verify auto‑detection.
Automated testing with Jest
For CI pipelines, add a simple Jest test that renders a component with the Spanish locale and asserts the expected text.
import { render } from '@testing-library/react';
import { I18nextProvider } from 'react-i18next';
import i18n from '../i18n';
import Header from '../components/Header';
test('renders Spanish welcome message', async () => {
await i18n.changeLanguage('es');
const { getByText } = render(
<I18nextProvider i18n={i18n}>
<Header />
</I18nextProvider>
);
expect(getByText('Bienvenido a OpenClaw')).toBeInTheDocument();
});Running npm test will now verify that your Spanish translations are correctly loaded.
After testing, you might want to run an SEO audit on the localized pages. The AI SEO Analyzer can quickly highlight missing meta tags, duplicate content, or language‑specific keyword gaps.
7. Conclusion
Localizing OpenClaw to Spanish is a matter of three core actions: integrate an i18n library, supply Spanish translation files, and expose a runtime language switcher. By following the steps above, you’ll deliver a polished multilingual experience that respects the cultural nuances of Spanish‑speaking users while keeping your codebase clean and maintainable.
Beyond localization, the OpenClaw template can be extended with many of UBOS’s AI‑powered services. For instance, you could embed the ChatGPT and Telegram integration to provide real‑time support in both languages, or use the ElevenLabs AI voice integration to add spoken prompts for accessibility.
Ready to showcase your multilingual app? Explore the UBOS portfolio examples for inspiration, and consider joining the UBOS partner program to get early access to new AI modules that can further enrich your product.
Happy coding, and enjoy bringing OpenClaw to Spanish audiences!