Siebrand has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/57062


Change subject: Do not normalise magic words
......................................................................

Do not normalise magic words

This is a bit unfortunate, because of existing legacy. I'd rather leave
the current behavior in place, but it increases chances of unintended
breakage.

Bug: 46614
Bug: 46613
Change-Id: I8f1442e1f44f6f617f33dcb7b029596744a5644d
---
M ffs/MediaWikiComplexMessages.php
1 file changed, 14 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Translate 
refs/changes/62/57062/1

diff --git a/ffs/MediaWikiComplexMessages.php b/ffs/MediaWikiComplexMessages.php
index 718fd02..8a4afde 100644
--- a/ffs/MediaWikiComplexMessages.php
+++ b/ffs/MediaWikiComplexMessages.php
@@ -14,7 +14,6 @@
  * @todo Needs documentation.
  */
 abstract class ComplexMessages {
-
        const LANG_MASTER = 0;
        const LANG_CHAIN = 1;
        const LANG_CURRENT = 2;
@@ -343,15 +342,27 @@
                return $this->databaseMsg . '/' . $this->language;
        }
 
+       /**
+        * @param WebRequest $request
+        * @return string
+        */
        function formatForSave( $request ) {
                $text = '';
+
+               // Do not replace spaces by underscores for magic words. See 
bug 46613
+               $replaceSpace = $request->getVal( 'module') !== 'magic';
+
                foreach ( array_keys( $this->data ) as $group ) {
                        foreach ( $this->getIterator( $group ) as $key ) {
                                $data = $request->getText( 
$this->getKeyForEdit( $key ) );
                                // Make a nice array out of the submit with 
trimmed values.
                                $data = array_map( 'trim', explode( ',', $data 
) );
-                               // Normalise: Replace spaces with underscores.
-                               $data = str_replace( ' ', '_', $data );
+
+                               if( $replaceSpace ) {
+                                       // Normalise: Replace spaces with 
underscores.
+                                       $data = str_replace( ' ', '_', $data );
+                               }
+
                                // Create final format.
                                $data = implode( ', ', $data );
                                if ( $data !== '' ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8f1442e1f44f6f617f33dcb7b029596744a5644d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Translate
Gerrit-Branch: master
Gerrit-Owner: Siebrand <siebr...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to