Internationalization (i18n)
Oura has built-in support for 10 languages and allows you to define custom translations for any locale.
Setting the Locale
Pass locale to Oura.configure() at the start of your app:
javascript
import Oura from 'oura-ui';
Oura.configure({
locale: 'es', // Button labels will use Spanish
});
// Now buttons will show "Confirmar", "Cancelar", etc.
await Oura.confirm('¿Eliminar elemento?', 'Esta acción es permanente.');Built-in Languages
| Code | Language |
|---|---|
en | English (default) |
es | Español |
fr | Français |
de | Deutsch |
it | Italiano |
pt | Português |
zh | 中文 |
ja | 日本語 |
ru | Русский |
ar | العربية |
Custom Translations
Use customI18n to add your own language or override existing strings:
javascript
Oura.configure({
locale: 'ca',
customI18n: {
ca: {
confirm: 'Confirmar',
cancel: 'Cancel·lar',
submit: 'Enviar',
continue: 'Continuar',
deny: 'Denegar',
},
},
});Per-Dialog Override
You can also override button text for a single dialog using confirmButtonText, cancelButtonText, or denyButtonText:
javascript
await Oura.confirm({
title: 'Discard changes?',
confirmButtonText: 'Yes, discard',
cancelButtonText: 'Keep editing',
});TIP
The locale setting only affects the default button labels. confirmButtonText always takes precedence.