summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'MLEB/Translate/ffs/AndroidXmlFFS.php')
-rw-r--r--MLEB/Translate/ffs/AndroidXmlFFS.php28
1 files changed, 17 insertions, 11 deletions
diff --git a/MLEB/Translate/ffs/AndroidXmlFFS.php b/MLEB/Translate/ffs/AndroidXmlFFS.php
index 82fd9cb1..1a721f08 100644
--- a/MLEB/Translate/ffs/AndroidXmlFFS.php
+++ b/MLEB/Translate/ffs/AndroidXmlFFS.php
@@ -75,9 +75,7 @@ class AndroidXmlFFS extends SimpleFFS {
}
protected function scrapeAuthors( $string ) {
- $match = [];
- preg_match( '~<!-- Authors:\n((?:\* .*\n)*)-->~', $string, $match );
- if ( !$match ) {
+ if ( !preg_match( '~<!-- Authors:\n((?:\* .*\n)*)-->~', $string, $match ) ) {
return [];
}
@@ -145,21 +143,29 @@ class AndroidXmlFFS extends SimpleFFS {
}
protected function writeReal( MessageCollection $collection ) {
- $template = '<?xml version="1.0" encoding="utf-8"?>';
+ global $wgTranslateDocumentationLanguageCode;
+
+ $collection->filter( 'hastranslation', false );
+ if ( count( $collection ) === 0 ) {
+ return '';
+ }
+
+ $template = '<?xml version="1.0" encoding="utf-8"?>';
$template .= $this->doAuthors( $collection );
$template .= '<resources></resources>';
$writer = new SimpleXMLElement( $template );
- $mangler = $this->group->getMangler();
- $collection->filter( 'hastranslation', false );
- if ( count( $collection ) === 0 ) {
- return '';
+ if ( $collection->getLanguage() === $wgTranslateDocumentationLanguageCode ) {
+ $writer->addAttribute(
+ 'tools:ignore',
+ 'all',
+ 'http://schemas.android.com/tools'
+ );
}
- /**
- * @var TMessage $m
- */
+ $mangler = $this->group->getMangler();
+ /** @var TMessage $m */
foreach ( $collection as $key => $m ) {
$key = $mangler->unmangle( $key );