The user voice request “Prevent translation getting silently overwritten when source resx file entry is modified” was the biggest change to the toolkit. Previously the approach was to invalidate any translation if the source string was changed. The design was intended to provide a clear model to ensure that modified strings would not be shipped with the previous (and possibly now invalid) translations. Joost van Schaik wrote a blog that clearly covers both the pros and cons of this approach – it is worth a quick read.
MAT’s new approach is to preserve translations when the original source string is changed. This is a simple enough logic change, but allowing the developer to know which translations are still valid and which ones need reviewing provided an interesting challenge. The solution is to provide notifications that don't block development efforts and are easy to review as well as remove! Let’s walk through an example to show how this works so you can take advantage of it right away.
We’ll intentionally add some typos and grammar issues as well as phrases that should be rewritten. As such, the initial strings look like this:
These errors did not get noticed until after they were translated and imported into the project. In fact, it was actually the translator that pointed them out. We now have translations based on our original source strings, including the errors. We decided to fix the typos and grammar errors as well as update the “Dare to play me again?” text to be a little more, hmm…, user friendly.
When the project is rebuilt, the translations are retained and a warning is produced stating that some existing translations need to be validated against their updated source strings.
Great! Now we are notified that there are translation concerns, but against what strings? Well, simply double-clicking the warning will start the Multilingual Editor and open the related XLF file. When the editor opens this file, it will determine if any strings need to be reviewed, and if found the message tab will be populated with the list of affected resources. Double-clicking (or right-click and select “Go to…”) on the specific message takes us to the resource in question. Now we can quickly check if this translation is still appropriate for the updated source string.
However, if not fluent in the target language - Japanese in this case - we can press the suggest button to get new suggestions from the Microsoft Terminology and Microsoft Translator services. If no satisfactory match is found, the XLF file can be sent back to the translator. If the translator is using MAT’s editor, they get the same notifications and can quickly make any necessary adjustments.
OK, this is great, but most of the translations are still valid because they were typos that the translator was able to work around. So how do we quickly remove these warnings?
For the editor there are a couple of options, but first let’s examine the new comment that was automatically added to the updated resource. The combination of that comment and a translation state of “Needs review” tells the system that the source string’s translation needs to be reviewed. Changing the translation state (for example: to ‘Translated’) or removing the comment will disable the indicator that triggers this notification. Pressing the “Clear’ button in the ‘Translation’ ribbon group will clear the message while retaining the existing translation. Note: Pressing the ‘Reset’ button will remove the translation and set the translation state to ‘New’.
The quickest way to do this globally in the editor is to select the ‘Filter’ tab, then the ‘Source Changed’ ribbon button. This will limit the grid view to only the strings that have changed sources with retained translations. Selecting the grid, pressing Ctrl+A, then clicking the ‘Clear’ ribbon button (on the ‘Home’ tab) will remove the notification for all resources. Note: Using this filter option is another great way to quickly review the changes.
Of course, pressing ‘Clear’ with a single resource selected will leave the other resource indicators intact for later or external review – even after multiple builds.
This provides great flexibility per language, but what if we have 5+ language files with changes that are only typos or spelling corrections that didn’t invalidate the translations? To put is simply – we just want the warning messages gone!
Easy! In the Visual Studio IDE, select some or all of the XLF files, then right-click to show the solution menu. Doing so will expose a new menu item that reads “Clear updated source warnings”. Selecting this menu will reset all indicators in each of the selected files. Now we’re free to build without receiving the updated source warning messages – unless changes are applied to translated source strings again.
In all fairness, we do want to point out a limitation that still exists. If you change the resource name (it’s ID), MAT will consider that resource removed and a new resource added. This is because the ID plays a critical role in the automatic management of the resources. In this case, the string will need to be retranslated. If the string was externally translated and the source string has not changed, you can recover the previous translation using the ‘Recycle XLIFF translations…’ menu. Simply reference the XLIFF file previously sent by the translator to recover that translation.
In addition to the above new functionality, we also added the “Parallel Machine Generated Translations” user voice request. When selecting multiple XLF files in the IDE, right-click and choose ‘Generate machine translations’. MAT will list all the files in the dialog box and process the translation requests in parallel. Clicking the red cancel image only cancels that file’s translation operation. The image will change to a green check mark once the file’s translation operation is completed. If you click on the green check mark, the completed file is removed from the list. This can be helpful to view only the remaining operations when translating numerous files at the same time. Once all the file operations have completed, the dialog will automatically close.
The MAT team believes these community driven improvements will help your efforts to create the best global apps around! As always, feel free to comment below and make use of the user voice site to request or vote for your favorite MAT feature.
The Multilingual App Toolkit team