Skip to content

Localization ​

The editor ships English eagerly and lazy-loads 34 other locales. Set the active language with localeName; the editor loads that locale's built-in strings on demand. Customize individual strings with localeDefinitionOverride, which is keyed by locale name and takes the same shape as the file uploader's config. As a plugin, both follow the uploader's localeName / localeDefinitionOverride automatically.

ts
// Standalone: pick the language and override specific strings per locale.
editor.localeName = 'de'
editor.localeDefinitionOverride = {
  en: { 'ai-image-editor-cancel': 'Dismiss' },
  de: { 'ai-image-editor-generate-btn': 'Los!' },
}

Supported locales: en ar az ca cs da de el es et fi fr he hy is it ja ka kk ko lv nb nl pl pt ro ru sk sr sv tr uk vi zh (and zh-TW). Browse the translations on GitHub: the base en.ts and the other locales.

Available strings ​

These are the keys you can override, shown with their English defaults (the base locale, enLocale). Every locale provides this core set:

ts
{
  'ai-image-editor-source-label': 'Generate image',       // uploader source button
  'ai-image-editor-file-action-label': 'AI Edit',         // uploader file action
  'ai-image-editor-generate-title': 'Generate image',     // header, generate mode
  'ai-image-editor-edit-title': 'Edit image',             // header, edit mode
  'ai-image-editor-generate-placeholder': 'Create image...',
  'ai-image-editor-edit-placeholder': 'Edit image...',
  'ai-image-editor-cancel': 'Cancel',
  'ai-image-editor-generate-btn': 'Generate',
  'ai-image-editor-done-btn': 'Done',
  'ai-image-editor-start-over': 'Start over',
  'ai-image-editor-history-title': 'Recent prompts',
  'ai-image-editor-busy': 'Generating…',                  // progress label
  'ai-image-editor-error': 'Something went wrong. Try again.', // generic error
  'ai-image-editor-fullscreen': 'View fullscreen',
  'ai-image-editor-exit-fullscreen': 'Exit fullscreen',
  'ai-image-editor-aspect-ratio-aria': 'Pick aspect ratio',
  'ai-image-editor-aspect-original': 'Original',
  'ai-image-editor-aspect-square': 'Square',
  'ai-image-editor-aspect-tall': 'Tall',
  'ai-image-editor-aspect-wide': 'Wide',
  'ai-image-editor-aspect-portrait': 'Portrait',
  'ai-image-editor-aspect-landscape': 'Landscape',
  'ai-image-editor-aspect-vertical': 'Vertical',
  'ai-image-editor-aspect-widescreen': 'Widescreen',
}

enLocale is exported if you need to look strings up outside the element:

ts
import { enLocale } from '@uploadcare/ai-image-editor'

enLocale['ai-image-editor-generate-btn'] // 'Generate'

Error messages ​

When a generation or edit fails, the editor maps the error_code to an ai-image-editor-error-<code> key and shows that message; a code it has never heard of falls back to the generic ai-image-editor-error. Every key is optional in every locale, so translate only the ones you care about and the rest fall back to English:

ts
editor.localeDefinitionOverride = {
  de: {
    'ai-image-editor-error': 'Etwas ist schiefgelaufen. Bitte erneut versuchen.',
    'ai-image-editor-error-content_moderated': 'Diese Anfrage wurde blockiert.',
  },
}

Several codes deliberately read the same. These messages are for the person using your site, who knows nothing about your Uploadcare project and can't fix it, so a failure they can't act on says only "Something went wrong. Try again." and every token failure says the same line. The code itself is never lost: it's on the uc:error event and in the console, where you can act on it.

KeyDefault message
ai-image-editor-errorSomething went wrong. Try again.
ai-image-editor-error-invalid_requestSomething went wrong. Try again.
ai-image-editor-error-invalid_sourceThis image can't be used. Please try a different one.
ai-image-editor-error-source_not_foundThis image can't be used. Please try a different one.
ai-image-editor-error-source_not_imageThat file isn't an image. Please choose an image.
ai-image-editor-error-source_url_unavailableThat image couldn't be loaded. Please try again.
ai-image-editor-error-invalid_aspect_ratioThat aspect ratio isn't supported. Please pick another one.
ai-image-editor-error-canvas_too_largeThis image is too large (over 4 megapixels). Try a smaller one.
ai-image-editor-error-canvas_dimension_too_smallThis image is too small. Each side must be at least 256 pixels.
ai-image-editor-error-source_extends_beyond_canvasThis image doesn't fit that aspect ratio. Try one closer to the image's own shape.
ai-image-editor-error-derivative_disabledImage generation isn't available right now. Please try again later.
ai-image-editor-error-job_id_requiredSomething went wrong. Try again.
ai-image-editor-error-job_not_foundSomething went wrong. Try again.
ai-image-editor-error-ProjectPublicKeyInvalidErrorImage generation isn't available right now. Please try again later.
ai-image-editor-error-AccessTokenInvalidErrorSomething went wrong. Please reload the page and try again.
ai-image-editor-error-AccessTokenExpiredErrorSomething went wrong. Please reload the page and try again.
ai-image-editor-error-ScopeForbiddenErrorSomething went wrong. Please reload the page and try again.
ai-image-editor-error-OperationsLimitExceededErrorSomething went wrong. Please reload the page and try again.
ai-image-editor-error-SignatureRequiredErrorSomething went wrong. Please reload the page and try again.
ai-image-editor-error-auth_token_failedSomething went wrong. Please reload the page and try again.
ai-image-editor-error-content_moderatedThat prompt isn't allowed. Try describing it differently.
ai-image-editor-error-provider_unavailableThe image service is busy right now. Please try again in a moment.
ai-image-editor-error-generation_timeoutThe image service is busy right now. Please try again in a moment.
ai-image-editor-error-RequestThrottledErrorThe image service is busy right now. Please try again in a moment.
ai-image-editor-error-invalid_inputSomething went wrong. Try again.
ai-image-editor-error-DownloadFileHTTPClientErrorSomething went wrong. Try again.
ai-image-editor-error-DownloadFileNotFoundErrorSomething went wrong. Try again.
ai-image-editor-error-DownloadFileTaskFailedErrorSomething went wrong. Try again.