Besides managing translations of static content (e.g. user interfaces), you can also use Phrase to translate dynamic segments, e.g. blog posts or product information typically stored in a database.
We recommend to keep your translations of dynamic content in a separate Phrase 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”.
Since all content is organized as keys and values, you need to decide on a key structure for your dynamic content. It is usually a good idea to include the unique identifier from your database in the key name:
Depending on the size and nature of your dynamic content, you can also use tagging to further improve the structure of your keys.
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.
We recommend to work solely in Phrase 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.
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.