60 foreach ( $files as $filename => $contents ) {
61 $reader = $readerFactory->getReader( $filename );
63 $parsed = $reader->parse( $contents );
64 }
catch ( \Exception
$e ) {
65 trigger_error( __METHOD__ .
": Unable to parse messages from $filename", E_USER_WARNING );
69 foreach ( $parsed as
$code => $langMessages ) {
76 $c = array_sum( array_map(
'count', $parsed ) );
78 # echo "$filename with " . get_class( $reader ) . " and $c\n";
132 $components = $finder->getComponents();
134 $updatedMessages = [];
136 foreach ( $components as $key => $info ) {
137 $originFiles = $this->fetchFiles( $fetcherFactory, $info[
'orig'] );
138 $remoteFiles = $this->fetchFiles( $fetcherFactory, $this->expandRemotePath( $info, $repos ) );
140 if ( $remoteFiles === [] ) {
145 $originMessages = $this->readMessages( $readerFactory, $originFiles );
146 $remoteMessages = $this->readMessages( $readerFactory, $remoteFiles );
148 if ( !isset( $remoteMessages[
'en'] ) ) {
156 $forbiddenKeys = $this->findChangedTranslations(
157 $originMessages[
'en'],
158 $remoteMessages[
'en']
162 unset( $originMessages[
'en'], $remoteMessages[
'en'] );
165 foreach ( $remoteMessages as $language => $remoteTranslations ) {
167 $originTranslations = [];
168 if ( isset( $originMessages[$language] ) ) {
169 $originTranslations = $originMessages[$language];
172 $updatedTranslations = $this->findChangedTranslations(
179 if ( $updatedTranslations === [] ) {
183 if ( !isset( $updatedMessages[$language] ) ) {
184 $updatedMessages[$language] = [];
189 $updatedMessages[$language] += $updatedTranslations;
193 return $updatedMessages;