Updating Content

Find out how you can easily update your source files in Transifex, whether you prefer to do it manually or automatically.

Nina avatar
Written by Nina
Updated over a week ago

📝 Note: This article only applies to file-based projects.

When translating an app or website, you'll likely add and change strings constantly, meaning the files with your source content will also change. Instead of uploading a new file and creating a new resource each time a file changes, you can update an existing resource. There are a few ways to update files in Transifex.


Manually updating source files

To manually update source files:

  1. From the project navigation in the Dashboard, click on the project, which contains the resource you want to update.

  2. Click the Resources link.

  3. Click on the resource you want to update.

  4. In the header, click Update source file.

resource-lang-breakdown.png#asset:4246

Before uploading the new version of your source content, ensure that you select the appropriate options for the upload:

  1. Replace edited strings: By checking this option, any strings you update that were previously modified in the editor will be overwritten. Read more about edited strings here.

  2. Keep existing translations: Selecting this option allows you to retain translations when you update the source text of your strings.

There are several scenarios depending on the file’s contents and whether the options "Replace edited strings" and "Keep existing translations" have been selected. These scenarios are depicted in the below diagram.

💡Tip: The image may be too small when viewing the article. Please feel free to click it so it opens in its own tab and view it at full size.

Also, it's important to note that if the new source file version does not include any source strings, all currently hosted strings in Transifex will be deleted, regardless of whether the "Replace edited strings" option was checked.


Automatically updating source files

Manually updating source files isn't fun or scalable if you've got frequent updates. To avoid this, you can have Transifex automatically check for updates to your source file by simply providing Transifex with the public URL of the file. The file can be hosted on any service, such as GitHub or Dropbox. For services like Filezilla, though downloading is blocked for a script, automatically updating source files via URL is not supported.

📝 Note: You can also use a file from a private repository in GitHub if the URL has the respective token that GitHub provides.

Transifex will check that URL for updates four times per day (every 6 hours), and if there are any changes to the file, it'll fetch the file and update the resource in Transifex.

Because the check happens four times a day, there may be a delay between when you update a file and when Transifex detects the changes. The updated resource will automatically be available to your translators and reviewers.

Here's how to set up automatic updates of source files:

  1. Select a project from the project navigation in the Dashboard.

  2. Click the Resources link.

  3. Click on the three dots on the top right and then Auto-update resources from the drop-down menu.

  4. In the popup, click on the resource you want to auto-update.

  5. Add the URL of your file and hit Update URL. Transifex will check to make sure the file can be accessed.

    resource-automatic-update.png#asset:160

📝 Note: The file updates could be delayed due to the number of file update tasks the system needs to process.

This means the system may need 15 minutes more to process all the pending tasks in the queue for all the resources that are expected to be updated simultaneously.

If you want to stop auto-updating a resource, simply remove the URL to the file. After doing so, you'll receive three warning emails letting you know the auto-update will fail. This is normal since Transifex checks the URL and sends out notifications whenever the URL isn't working.

Auto-Updating a Google Drive Resource

The format of the URL for auto-updating a spreadsheet from Google Drive is as follows:

https://docs.google.com/spreadsheets/d/FILE_ID/export?format=xlsx


Using the API or command-line client to update source files

If you want to automate your localization process further, you can use Transifex's API or command-line client and integrate it with your build process. This way, you can automatically push updated content to Transifex and pull translated files when they are complete.

When using the API and, specifically, the resource_strings_async_uploads endpoint, similar to the UI, you can replace edited strings and keep existing translations from there.

  • To replace edited strings via API, set replace_edited_strings to true.

  • To keep existing translations, you can set the keep_translations parameter to true.

When using the Go CLI, just like the UI and API, you can replace edited strings and retain existing translations using the following options: --replace-edited-strings and --keep-translations.


What happens when you update files

A file is essentially a collection of strings. When you update a file and the option "Keep existing translations" is disabled, the following happens:

  1. Identical strings that are in both the original file (e.g., file.po) and the updated file (e.g., file_v2.po) -> will remain in Transifex along with their translations.

  2. New strings are added to Transifex -> These strings will appear as untranslated.

    If a similar string was translated in the past, translators can use Translation Memory to help them translate the new string. If a 100% match is detected and Translation Memory autofill is enabled, all the previously submitted translations will be replicated within those new untranslated strings.

  3. Strings from the original file are no longer present in the updated file -> These strings will not appear in Transifex.

    If these strings were translated in the past, within the original file, the translation would be preserved in the Translation Memory.

  4. Modified strings are added to Transifex.

    In the case of a file with a key-value structure, two different scenarios might occur:

    1. Modified strings (values/source text)

      The text of an existing source string is modified, but the key remains the same.

      e.g.

      The initial version of the source string:

      New version:

      After updating the source file, Transifex will identify that your text has been modified, so the string's translation should be re-evaluated.

      As a result:

      • Any previously submitted translation is removed from the translation area, and the string is considered untranslated.

      • The translation history of the string is being preserved and can be found under the History tab in the editor.

      • Any previously applied tags/instructions are preserved.

      • Any translators’ comments are preserved.

    2. Modified strings (keys/identifiers)

      The key of an existing source string is modified, but the source text remains the same.

      e.g.

      The initial version of the source string:

      New version:

      After updating your source file:

      • The string with the modified key will be considered a completely new one.

      • Any comments/tags/history/translation of the previous entry will be lost since the entry with the previous version of the key is removed from your resource in Transifex.

      However, the old translations are kept in the Translation Memory of your project. So, if you have the feature "Fill up resources from TM" enabled, TM will detect the old strings and automatically kick in all the previously submitted translations if the match is 100%. If the match is not 100%, previous translations appear in the “Suggestions” tab.

Here's a visual example. We have a source file with entities a, b, and c translated into two languages. Then we push an update with entity c removed and entity d added. The translated files are updated according to the new source file. In addition, the previous Italian translation (c → c2) is saved in the TM.


💡Tip

Looking for more help? Get support from our Transifex Community Forum!

Find answers or post to get help from Transifex Support and our Community.

Did this answer your question?