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


(Dmitry Fedyuk) #1

An example of untranslatable phrase:

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:

The pattern does not remove apostrophes inside phrases.

My fix is to patch the following line:

Replace the highlighed line with the new one:

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

The ​​​​​​​​​«data-bind i18n» expressions with JavaScript function calls are used in the core, but untranslatable due to the regular expression and architectural limitations
(Dmitry Fedyuk) #2

See also: