> For the complete documentation index, see [llms.txt](https://codemash.gitbook.io/codemash/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://codemash.gitbook.io/codemash/cloud/sms/templates/translate.md).

# Translate a template

Add a language to an SMS template, so every project language has its own text.

**Where:** SMS → Templates → a template → **Translations** · `/projects/<project>/sms/templates/<id>/edit`

## Before you start

* The language is a project language — add it under [Project → Settings → Languages](/codemash/cloud/project/settings/languages.md). The language tags show the project languages.
* The template is saved and active — see [Create or edit a template](/codemash/cloud/sms/templates/editor.md).

## Steps

1. Open the template, for example `Delivery update`, whose list row says **Missing lt**.
2. Under **Translations**, press the tag of the missing language, `LT`. A new block opens with **Language** `Lithuanian lt` (fixed) and an empty **Message body**. Pressing a selected tag again, or the bin icon of a block, removes that language.
3. Write the text in that language. Use the same tokens as the other languages, e.g. `Sveiki, @Model.FirstName, jūsų Acme užsakymas @Model.OrderNumber jau pakeliui.`

   <figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-b8d7e5c124f20a78cd814503962664f1be46c0b4%2Ftemplates-translate-1.png?alt=media" alt="The English block with 70 / 160 characters, the new Lithuanian block with the Lithuanian body and 78 / 160 characters, and the Marketing SMS / Transactional SMS choice below"><figcaption><p>The template with an English and a Lithuanian text.</p></figcaption></figure>
4. Press **Update**.

## Result

Cloud returns to the [templates list](/codemash/cloud/sms/templates.md). The **Missing lt** badge is gone, so campaigns and triggers can use the template again.

<figure><img src="https://712692422-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHy372bqsaex2cqS3ikhL%2Fuploads%2Fgit-blob-ed64f4727d4037ec071107f48f260a70e85068fb%2Ftemplates-translate-2.png?alt=media" alt="SMS Templates list where Delivery update has no Missing badge any more"><figcaption><p>Every project language has a text.</p></figcaption></figure>

Which text a person gets: the language forced on the campaign or trigger, else the recipient's own language when it is a project language, else the project's default language. Typed phone numbers always get the default language. Extra template languages that are not project languages are allowed and never sent.

## Change or remove it later

* **Change a text** — edit the block and press **Update**.
* **Remove a language** — press the bin icon of its block, then **Update**. A project language that loses its text makes the template **Missing …** again.
* **Add a project language later** — Project settings lists the active templates that would miss it and asks *Save anyway?*; after that those templates show **Missing …** until you translate them.

## Do it from code

There is no separate translate call: send the template again with the new translation.

```ts
const id = 'tmpl_uPd8HlhhXsodOyFY752Se'; // Delivery update
const { item } = await norbix.hub.notifications.getSmsTemplate({ id });
const lt = { language: 'lt', content: { body: 'Sveiki, @Model.FirstName, jūsų Acme užsakymas @Model.OrderNumber jau pakeliui.' } };
await norbix.hub.notifications.updateSmsTemplate({
  viewId: id,
  templateName: item.templateName,
  communicationChannel: item.communicationChannel,
  translations: [...item.translations.filter((t) => t.language !== 'lt'), lt],
});
const { tokens } = await norbix.hub.notifications.getSmsMessageContentTokens({ id });
console.log(tokens); // { en: [ 'FirstName', 'OrderNumber' ], lt: [ 'FirstName', 'OrderNumber' ] }
```

```sh
norbix hub notifications sms message content tokens get --id tmpl_uPd8HlhhXsodOyFY752Se
```

The client setup is on the [SMS page](/codemash/cloud/sms.md#use-it-from-code). API: [Update Sms Template](/codemash/api-reference/notifications/sms/update-sms-template.md) · [Get Sms Message Content Tokens](/codemash/api-reference/notifications/sms/get-sms-message-content-tokens.md)
