Update Translated Files with File Rewrite Rules
There may be occasions when you need to make a change to your translations upon downloading the translated file, without updating the translations in the Translation Memory or anywhere on the Smartling dashboard. Such changes could include updating a single word or phrase, an entire string or block of text, or even a URL, similarly to performing a find and replace all within the translated file.
With File Rewrite Rules, Account Owners and Project Managers can define changes to be applied to translations for any language, within any file-based project in your account, translating in any of the supported file types.
Example - Localizing URL's
If your translated file contains a URL, such as www.yourcomany.com, to protect the URL, the Smartling CAT Tool does not allow linguistics to edit a URL, but does allow them to place the URL in the correct position of the translation. Using File Rewrite Rules, you can create a rule that rewrites www.yourcompany.com to www.yourcompany.fr in French translated files, www.yourcompany.de in German translated files, etc. See how to create this rule below.
The rewrite is only visible in the downloaded supported file type, and not anywhere in the Smartling Dashboard. The rewrite is visible in pseudo, current and published file downloads. You can download the file from within the Job Details, from the Files tab, or via the API. The File Rewrite Rule must be created before downloading the file.
Supported File Types
- Microsoft Office - Excel, PowerPoint, Word
- Android XML
- iOS Strings
- Rich Text Format (RFT)
In cases where you want to create the one File Rewrite Rule to be applied to some or all languages, you can save time and effort by using the available variables:
- $locale: rewrites to each language's locale ID
- $language: rewrites to each language's language ID
- $country: rewrites to each language's country ID
All of Smartling's supported variable types above can be found in this article. A locale ID consists of a language ID and country ID.
Create a File Rewrite Rule
- In your Smartling Account, go to Account Settings > File Rewrite
- Click New Rule
- Complete the fields in the Rewrite Rule dialog:
- Choose a Project on the Account to apply the rule to
- Choose the languages the rule should apply to
- Choose the file types that should contain the rewrite rule once downloaded
- Add a Rule Description
- Enter what the rule should find and rewrite from
- Enter what the rule should replace all with and rewrite to
- Ensure the rule is enabled
- Click Save
Rewrite rules are case-sensitive and must be unique. If you create multiple rules with the same Rewrite From, for the same projects, languages and files types, the first rule that was created takes precedence over the rest.
To save time and effort in identifying each Rewrite Rule with a unique ID, Smartling automatically creates a unique Rule ID for each File Rewrite Rule create. This way you can quickly identify a rule, and if needed, reference this ID both internal and external communication.
Search & Filters
You can locate any rule quickly and easily by using the following search and filters:
- File Type
- Rewrite From
- Rewrite To
- Rule ID
- Enabled / Disabled
It is possible to share your filter selection with another Account Owner or Project Manager user by sharing the URL.
Click the ellipses (3 dots) beside each File Rewrite Rule to complete any of the following actions, or you can also choose to carry out bulk actions by multi-selecting File Rewrite Rules and click the Actions button:
- Edit - not available as a bulk action
- Enable / Disable
- Clone Rule - not available as a bulk action
Test Test Test
Always test any rule you create before implementing it with real content. Just as with any "Find & Replace All" action, Rewrite Rules are a powerful function that could potentially destroy your content if implemented without proper testing. Consider any possible corruption to the JSON or HTML in your content, including translatable HTML values in <tags>. As mentioned below, only translatable content can be rewritten, so keys shouldn’t be affected; however, testing is always recommended.
Mostly, Only Translatable Content Can Be Rewritten
For most file formats, only the translatable content from the file is rewritten - with the exception of URLs from docx, xlsx, pptx files.
It is not possible to rewrite file attributes, such as tags, as Smartling does not ingest native tags from files, such as with XLIFF files.