49 $ignoreTrailingWhitespace = $this->getOption(
'ignore-trailing-whitespace' );
50 $groups = $this->getGroups( $this->getArg( 0 ) );
51 $matched = count( $groups );
52 $this->output(
"Pattern matched $matched file based message group(s).\n" );
53 $this->output(
"Left side is the expected value. Right side is the actual value in wiki.\n" );
55 $groupsWithIssues = [];
56 foreach ( $groups as $group ) {
57 $sourceLanguage = $group->getSourceLanguage();
58 $collection = $group->initCollection( $sourceLanguage );
59 $collection->loadTranslations();
61 foreach ( $collection->keys() as $mkey => $title ) {
62 $message = $collection[$mkey];
63 $definition = $message->definition() ??
'';
64 $translation = $message->translation() ??
'';
66 $differs = $ignoreTrailingWhitespace
67 ? rtrim( $definition ) !== $translation
68 : $definition !== $translation;
71 $groupsWithIssues[$group->getId()] = $group;
72 echo Title::newFromLinkTarget( $title )->getPrefixedText() .
"\n";
73 echo $this->getSideBySide(
"'$definition'",
"'$translation'", 80 ) .
"\n";
78 if ( $this->hasOption(
'fix' ) && $groupsWithIssues ) {
79 foreach ( $groupsWithIssues as $group ) {
80 $cache = $group->getMessageGroupCache( $group->getSourceLanguage() );
83 $script = realpath( __DIR__ .
'/../../scripts/importExternalTranslations.php' );
84 $groupPattern = implode(
',', array_keys( $groupsWithIssues ) );
85 $command = Shell::makeScriptCommand( $script, [
'--group', $groupPattern ] )->getCommandString();
86 echo
"Now run the following command and finish the sync in the wiki:\n$command\n";
108 $aArray = explode(
"\n", wordwrap( $a, $wrapWidth,
"\n",
true ) );
109 $bArray = explode(
"\n", wordwrap( $b, $wrapWidth,
"\n",
true ) );