jenkins-bot has submitted this change and it was merged.

Change subject: WIP: Remove duplicate insertables
......................................................................


WIP: Remove duplicate insertables

This doesn't have unit tests yet.

Change-Id: I85697c2264a8b28f86c655a228900663dd9be1e9
---
M translationaids/InsertablesAid.php
1 file changed, 9 insertions(+), 6 deletions(-)

Approvals:
  Siebrand: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/translationaids/InsertablesAid.php 
b/translationaids/InsertablesAid.php
index e6ed521..65b36f8 100644
--- a/translationaids/InsertablesAid.php
+++ b/translationaids/InsertablesAid.php
@@ -35,19 +35,22 @@
                        throw new TranslationHelperException( "Group does not 
have a suggester" );
                }
 
-               $blob = array(
-                       '**' => 'insertable',
-               );
-
                $insertables = $suggester->getInsertables( 
$this->getDefinition() );
+               $blob = array();
                foreach ( $insertables as $insertable ) {
-                       $blob[] = array(
-                               'display' => $insertable->getDisplayText(),
+                       $displayText = $insertable->getDisplayText();
+
+                       // The keys are used for de-duplication
+                       $blob[$displayText] = array(
+                               'display' => $displayText,
                                'pre' => $insertable->getPreText(),
                                'post' => $insertable->getPostText(),
                        );
                }
 
+               $blob = array_values( $blob );
+               $blob['**'] = 'insertable';
+
                return $blob;
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/84662
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I85697c2264a8b28f86c655a228900663dd9be1e9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Amire80 <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to