- 
                Notifications
    You must be signed in to change notification settings 
- Fork 111
feat: add translation feature documentation #910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from 8 commits
      Commits
    
    
            Show all changes
          
          
            9 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      204d83a
              
                fix: add translation feature documetation
              
              
                jainpawan21 32ca981
              
                fix: add translations link on build a workflow page
              
              
                jainpawan21 c8b8a7c
              
                fix: add code rabbit suggestions
              
              
                jainpawan21 29610f9
              
                fix: add suggestions
              
              
                jainpawan21 bbdb431
              
                fix: add master json and export/import info
              
              
                jainpawan21 e3289d9
              
                fix: add nested key example
              
              
                jainpawan21 9a56a7e
              
                fix: back tick
              
              
                jainpawan21 e3da18e
              
                fix: code rabbit suggestions
              
              
                jainpawan21 6a96433
              
                fix: add victor's suggestions
              
              
                jainpawan21 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| --- | ||
| title: 'Translations' | ||
| description: 'Learn how to translate your workflow step content into multiple languages' | ||
| icon: 'Languages' | ||
| --- | ||
|  | ||
| ## Workflow translations | ||
|         
                  jainpawan21 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| Novu supports multi-language translations for workflows, allowing your notifications to dynamically adapt to your users' preferred language. This documentation covers everything you need to know to enable, configure, and manage translations for your workflows. | ||
|         
                  jainpawan21 marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved         
                  jainpawan21 marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
|  | ||
| <Callout type="info"> | ||
| The translations feature is currently in `beta` and is available for `Team` and `Enterprise` plans. | ||
|         
                  jainpawan21 marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| </Callout> | ||
|  | ||
| Workflow translations allow each notification workflow, such as onboarding, password reset, and one time password (OTP), to support multiple locales. When a subscriber receives a notification, Novu selects the appropriate translation based on the subscriber's locale. | ||
|         
                  jainpawan21 marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved         
                  jainpawan21 marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
|  | ||
| This feature helps teams: | ||
|  | ||
| - Reach users in their native language. | ||
| - Customize language per workflow or layout. | ||
| - Reduce friction in communication across geographies. | ||
|  | ||
| You can manage translations on the [translation page](https://dashboard.novu.co/translations) in the Novu dashboard. Select the default language and add the target languages that you wish to support. | ||
|  | ||
|  | ||
|  | ||
| ## Enabling translations | ||
|  | ||
| To use translations for a workflow, you need to enable them on the workflow level. | ||
|  | ||
| ### While creating a new workflow | ||
|  | ||
| - Turn on the **Enable Translations** toggle | ||
| - Set the default locale, such as `en_US` or `en_GB` | ||
| - Add the target locales you wish to support, such as `fr_FR`, `es_ES`, `ja_JP` | ||
|  | ||
| ### While editing an existing workflow | ||
|  | ||
| - Open an existing workflow | ||
| - Turn on the **Enable Translations** toggle | ||
| - You don't need to take any action if the toggle is already on | ||
|  | ||
| You can configure the default and targeted locales on the [translation page](https://dashboard.novu.co/translations). | ||
|  | ||
|  | ||
|  | ||
| ## Translation groups | ||
| A translation group contains all language variants for a workflow identified by a unique workflow ID. | ||
|  | ||
| You can: | ||
|  | ||
| - Search for groups on the translations page | ||
| - View status per locale ('Outdated' or 'Up to date') | ||
| - Import or export translations for a specific locale, such as `en_US` | ||
| - Import or export translations for all workflows where translations are enabled | ||
|  | ||
| ## Translation JSON format | ||
|         
                  jainpawan21 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| Each locale supports JSON-based translation files. For example, the `en_US.json` file contains the default translations for the workflow. You can update the translation JSON files using the JSON editor on the translation page. | ||
|  | ||
| ```json | ||
| { | ||
| "in-app": { | ||
| "title": "Welcome to Novu!", | ||
| "message": "Hi {{subscriber.firstName}}, let's get started!" | ||
| }, | ||
| "email": { | ||
| "subject": "Get Started", | ||
| "body": "Thank you for joining us, {{subscriber.fullName}}" | ||
| } | ||
| } | ||
| ``` | ||
|  | ||
| You can update translations by editing the JSON files in the editor on the translations page or by exporting and re-uploading them. | ||
|  | ||
|  | ||
|  | ||
| ## Exporting and importing translations | ||
|         
                  jainpawan21 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| If you prefer to create/update translations in a JSON file outside the Novu dashboard, you can do so by exporting and importing them. | ||
|  | ||
| ### Export | ||
|  | ||
| - Navigate to the translations page. | ||
| - Select the workflow you want to export translations for. | ||
| - Click on the locale, such as `en_US`, now click on the download icon to download the latest default locale translation JSON file. | ||
|  | ||
| ### Import | ||
|  | ||
| - Navigate to the translations page. | ||
| - Select the workflow you want to import translations for. | ||
| - Click on the locale, such as `en_US`, now click on the **Import Language(s)** button to upload the translation JSON file. | ||
| - Novu detects the locale automatically using the file name | ||
|  | ||
| 💡 Translation changes in default locale such as `en_US` will mark other locales as *Outdated, needs update* | ||
|  | ||
| ### Master JSON file | ||
|  | ||
| Master JSON file is a JSON file that contains the default locale's translations keys of all the workflows where translations are enabled. You can import or export this file from the translations page. Below is an example of a master JSON file: | ||
|  | ||
| ```json | ||
| { | ||
| "workflows": { | ||
| "events-publish": { | ||
| "key": "value" | ||
| }, | ||
| "events-update": { | ||
| "subject": "A new update", | ||
| "content": "{{payload.eventName}} event has been updated" | ||
| } | ||
| } | ||
| } | ||
| ``` | ||
|  | ||
|  | ||
|  | ||
| ## Using translation keys in step content editor | ||
|  | ||
| In Email or In-App editors, use `{{t.key}}` to insert a translatable string. If the key already exists for the locale, it appears in the suggestions list. | ||
|  | ||
| Clicking **Add to Translations** automatically adds a new key to default locale. | ||
|  | ||
| Example: | ||
|  | ||
| ```html | ||
| {{t.subject}} → "Let's get you started" | ||
|         
                  jainpawan21 marked this conversation as resolved.
              Show resolved
            Hide resolved | ||
|  | ||
| {{t.product.details.description}} | ||
| ``` | ||
|  | ||
|  | ||
|  | ||
| ## Testing translations | ||
|  | ||
| Use the Preview Context to: | ||
|  | ||
| - Simulate subscriber locale such as `fr_FR` or `ru_RU` | ||
| - Preview step content for the selected language. | ||
| - Update or correct missing translations on the fly. | ||
|  | ||
| ## Keeping translations up to date | ||
|  | ||
| Any edit to the default locale will invalidate others. You’ll see a warning: `Outdated, needs update`. Re-export the default, update translated files, and re-upload. | ||
|  | ||
| ## Disabling Translations | ||
|  | ||
| A translation group can be disabled by clicking on the three dots and selecting **Disable & delete translations**. This action is irreversible and removes all associated translation data. | ||
|  | ||
| ## Translation in Layouts | ||
|         
                  jainpawan21 marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| This feature is currently a work in progress. If you need translation support in email layouts, reach out to us at [email protected] | ||
|  | ||
|  | ||
| ## Best practices | ||
|  | ||
| - Always finalize your default content before exporting. | ||
| - Avoid hardcoded language in the content editor. | ||
| - Use variables and translation keys consistently. | ||
| - Set subscriber locale properly to deliver notifications in the correct language. | ||
|  | ||
        
          
          Binary file added
          
            BIN
              
                +1.92 MB
              
          
        
  ...mages/platform/workflow/translations/translations-default-and-target-locale.gif
  
  
      
      
   
        
      
      
    
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
        
          
          Binary file added
          
            BIN
              
                +2.28 MB
              
          
        
  public/images/platform/workflow/translations/translations_locale_content_edit.gif
  
  
      
      
   
        
      
      
    
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
        
          
          Binary file added
          
            BIN
              
                +436 KB
              
          
        
  public/images/platform/workflow/translations/translations_master_json_file.png
  
  
      
      
   
        
      
      
    
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
        
          
          Binary file added
          
            BIN
              
                +3.91 MB
              
          
        
  ...ges/platform/workflow/translations/translations_variable_use_in_step_editor.gif
  
  
      
      
   
        
      
      
    
      
      Loading
      
  Sorry, something went wrong. Reload?
      Sorry, we cannot display this file.
      Sorry, this file is invalid so it cannot be displayed.
      
    
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.