Bug: i18n phrases with apostrophes (') in Knockout templates are untranslatable (and my fix)

An example of untranslatable phrase:
https://github.com/magento/magento2/blob/daf301d625d8652996a6d3c9400e5f9816184bde/app/code/Magento/Ui/view/base/web/templates/grid/listing.html#L34

As you can see the phrase We couldn\'t find any records. contains an apostrophe, and it breaks translation.
Look at i18n regular expression pattern:
https://github.com/magento/magento2/blob/daf301d625d8652996a6d3c9400e5f9816184bde/app/code/Magento/Translation/etc/di.xml#L60

The pattern does not remove apostrophes inside phrases.

My fix is to patch the following line:

https://github.com/magento/magento2/blob/daf301d625d8652996a6d3c9400e5f9816184bde/app/code/Magento/Translation/Model/Js/DataProvider.php#L127

Replace the highlighed line with the new one:

$phrases[] = str_replace('\\\'', '\'', $match);

https://github.com/magento/magento2/issues/1951

See also: