Translate Dynamic Database Content

Besides managing translations of static content (e.g. user interfaces), you can also use PhraseApp to translate dynamic segments, e.g. blog posts or product information typically stored in a database.

Setup

Projects

We recommend to keep your translations of dynamic content in a separate PhraseApp project, next to the project you might already use for handling your static translations. Depending on the size of your dynamic content, it can also make sense to create separate projects for different content types, e.g. “My Project - Blog Posts” and “My Project - Products”.

Key Structure

Since all content is organized as keys and values, you need to decide on a key structure for your dynamic content. It is usally a good idea to include the unique identifier from your database in the key name:

  • products.10.name
  • products.10.description
  • products.10.summary
  • products.11.name
  • products.11.description
  • products.11.summary
  • etc.

Depending on the size and nature of your dynamic content, you can also use tagging to further improve the structure of your keys.

Sync Process

If you want to sync your dynamic content translations more than once, we recommend to write a script that handles uploading and downloading the content for you and that you can run when necessary, e.g. once per day or triggered by a webhook event.

Uploading content

For a quick initial upload it is sufficient to render your keys and source content in a simple CSV or JSON file and upload them directly using the push command or using the upload endpoint.

If you want to provide more context data such as screenshots and descriptions, we recommend creating key entries directly using the keys endpoint and attaching translation entries afterwards.

Updating content

We recommend to work solely in PhraseApp on the translated versions of your original content and only modify your source content directly in the database. This will free you from versioning conflicts that can occur if you modify your content also directly in your database.

Retrieving translations

For simple use cases we recommend to download the translations for your dynamic content using the pull command or directly with the download endpoint. You can basically specify whatever format works best for you but using an easy to parse format such as CSV or JSON might be a good idea.

For more advanced setups you can also access all translation entries directly using the API.

After retrieving the translations for each locale, simply store the content for each key and locale in your database.

Further reading