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.
Prerequisites#
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.
Use case 1: Use AI to localize a specific field#
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:
Go to the Uniform AI Prompt manager, located under
Settings
>AI
>Prompts
Click “Add Prompt” and select which connected AI service you want to use.
Create the prompt with
Translate to a current locale
as a name.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
andCurrent value
and you will need to insert those using the connect icon:Use AI to localize a specific fieldEnable the prompt on text parameters inside the
Context and Availability
panel.Use AI to localize a specific fieldClick "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 case 2: Use AI to localize a component#
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:
Go to the Uniform AI Prompt manager, located under
Settings
>AI
>Prompts
Click “Add Prompt” and select which connected AI service you want to use.
Create the prompt with name
Translate all content to current locale
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
andProperties current values
and you will need to insert those using the connect icon:Use AI to localize a specific fieldEnable the prompt on multiple text values inside the
Context and Availability
panel.
The video below shows how this is enabled:
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: