protected function _adjustI18n($contents)
{
// Basic functions
$pattern = '#__(n|c)?\\((\'|")(.*?)(?<!\\\\)\\2,#';
$replacement = function ($matches) {
$string = $matches[3];
$count = 0;
$c = 1;
while ($c) {
$repString = '{' . $count . '}';
$string = preg_replace('/%[sdefc]/', $repString, $string, 1, $c);
$count++;
}
return '__' . $matches[1] . '(' . $matches[2] . $string . $matches[2] . ',';
};
$contents = preg_replace_callback($pattern, $replacement, $contents, -1, $count);
// Domain functions
$pattern = '#__(|d|dc|dn|dcn)?\\((\'|")(.*?)(?<!\\\\)\\2,\\s*(\'|")(.*?)(?<!\\\\)\\4,#';
$replacement = function ($matches) {
$string = $matches[5];
$count = 0;
$c = 1;
while ($c) {
$repString = '{' . $count . '}';
$string = preg_replace('/%[sdefc]/', $repString, $string, 1, $c);
$count++;
}
return '__' . $matches[1] . '(' . $matches[2] . $matches[3] . $matches[2] . ', ' . $matches[4] . $string . $matches[4] . ',';
};
$contents = preg_replace_callback($pattern, $replacement, $contents, -1, $count);
return $contents;
}