# How To

# Translating Templates

Here is an example tutorial for switching between multiple languages using a DocumentEngine template:

  1. First, prepare a JSON data that contains the translated text for each language that you want to support. The JSON file should have a structure like this:
  1. Then, in your DocumentEngine template, use the {{#with}} helper to switch between the different languages. The {{#with}} helper takes an object as an argument, and it allows you to access the properties of the object using dot notation. Here is an example:
  1. To switch between languages, you can use the {{#with}} helper inside another {{#with}} helper. This allows you to specify the language that you want to use, and then access the text for that language using dot notation. Here is an example that switches between the English and French languages:
  1. You can also use variables to dynamically switch between languages based on user input or other conditions. To do this, use the {{#with}} helper in combination with the {{lookup}} helper. The {{lookup}} helper allows you to access a property of an object using a variable as the key. Here is an example that uses a variable selectedLanguage to switch between languages:
  1. Finally, don't forget to always include the JSON language data that contains the translated text in your DocumentEngine api request, so that you can access the text