For the complete documentation index, see llms.txt. This page is also available as Markdown.

Resource-Based PDF Translation

Overview

Resource-based PDF Translation loads PDF translations from a Form.io Language resource. Each submission in the resource holds the translations for one language. When a submission PDF is generated, the PDF Server selects the language and loads the matching translations from the resource.

Because translations are stored as resource submissions, anyone with access to the resource can add or update them in the Form.io portal without changing files or application code. The same Language resource can also provide translations for live forms.

Prerequisites

  • API Server 9.12.0 or later and PDF Server 5.17.0 or later.

  • A Language resource in the same project, with one submission for each language you want to support.

Setting Up the Language Resource

If a Language resource already exists, it can be applied to submission PDFs as well.

If one needs to be created, complete the following steps:

  1. Create a Language resource within the Project, called Language.

  2. Within this resource, add a Select Field (typically called "Language") for the Language Code. This maps the plaintext language name to the language identifier.

  3. Within the Select Field's Data tab, set Data Source to Values.

  4. For each language the form is localized to, create a Label identifying the plantext language name, and a Value identifying the language identifier.

  1. Add a Data Map to the Language Resource (typically called "Translation"), which contains Text Field that maps the default language text to the translated text, like the following:

The completed resource will look like the following:

  1. Press Create Resource button to create the new Resource.

Filling the Language Resource

Once this is created, use the resource to create a new submission for each translation. The following example illustrates the fields for EspaƱol:

Each submission will add the "language". This will be used to manage all of the translations in a standard way. Input the rest of the language translations the same way until there are multiple to choose from.

Language Resource "Read All Submissions" Access

For most applications, the end user will be authenticated when they are switching between languages. In some cases, the user may be anonymous. As with any resource, ensure that the proper Role has access to the Read All Submissions permission within the Access section of the Language form.

Configuring the Form

  1. Open the form and go to Form Settings.

  2. In the PDF Settings section, set PDF Translation Method to Form.io Language Resource:

  1. Complete the following settings:

Setting
Description

Form.io Language Resource

Select the Form.io Resource providing the desired language options and translation mappings that will be passed to the PDF Server when rendering PDF submissions.

Language Code Component

Select the Form.io component within the Language resource providing the language code.

Translation Map Component

Select the Form.io component within the Language resource providing the translation mapping.

The component lists show each component as Label (API key), for example Language Code (languageCode) and Translations (translations).

  1. Save the form settings.

Testing

Download a submission PDF and add the language parameter with a language code from your resource, for example ?language=es.

The value of language must match a value of the Language Code Component in one of the resource's submissions.

Last updated

Was this helpful?