How to use Generative AI for localization

With Uniform, brands have access to localize any experience. Localization can be applied to compositions (e.g., a page or an App screen), content entries, components, and data from connected sources.

With the rise of AI, there are great opportunities to leverage an AI service for localization. Uniform works with AI of choice, allowing brands to bring the AI service they want, anything from OpenAI to a custom service built on brand LLMs.

Once connected, AI can be used for localization across Uniform’s capabilities; below are examples of how to apply AI with Uniform.

This recipe will use OpenAI as example Generative AI integration within Uniform and will assume you installed and configured this integration with your own OpenAI API key.

You can use other generative AI integrations Uniform supports and even add your own. Learn more about how to install and configure a generative AI integration here.

ai-integrations
AI integrations Uniform supports out of the box

In this example, we want to leverage AI to localize a specific field value to the currently active locale.

The steps for this are simple:

  1. Go to the Uniform AI Prompt manager, located under Settings > AI > Prompts

  2. Click “Add Prompt” and select which connected AI service you want to use.

  3. Create the prompt with Translate to a current locale as a name.

  4. Enter the following into the prompt:

    Translate the following copy into <insert_Current_locale_variable_here>, this is the copy: <insert_Current value_variable_here>

    This prompt is using system variables Current locale and Current value and you will need to insert those using the connect icon:

    connect
    Use AI to localize a specific field
  5. Enable the prompt on text parameters inside the Context and Availability panel.

    step1
    Use AI to localize a specific field
  6. Click "Generate" button to test the prompt here to ensure it is working as expected.

Check out video below showing this use case in action:

Use AI to localize a specific field

We can also leverage AI to translate the content of a specific component into a specific language. The use case is that you can have a component, like a banner, call to action, hero etc., and then translate all of the content across the fields.

To enable this, we used the following steps:

  1. Go to the Uniform AI Prompt manager, located under Settings > AI > Prompts

  2. Click “Add Prompt” and select which connected AI service you want to use.

  3. Create the prompt with name Translate all content to current locale

  4. For the Prompt Text, provide the following

    Translate the given JSON document into ${\$locale}: ${\$propertiesCurrentValues}. Respond only with the translated JSON object with the same structure, exclude everything else in the response.

    This prompt is using system variables Current locale and Properties current values and you will need to insert those using the connect icon:

    connect
    Use AI to localize a specific field
  5. Enable the prompt on multiple text values inside the Context and Availability panel.

step2
Use AI to localize a component

The video below shows how this is enabled:

Use AI to localize a component

Use case 3: Use AI to translate an entire content entry to a new locale.#

The final example uses the same prompt we enabled in the previous example to translate a full content entry to a new locale. The video below highlights how that is done:

Use AI to translate an entire content entry to a new locale.