Siebrand has uploaded a new change for review.

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


Change subject: Fix gender related i18n issue in anon edit warning
......................................................................

Fix gender related i18n issue in anon edit warning

For languages in which "property" and "item" have a different gender, the
previous solution wouldn't work. Introduced separate messages for edit
warnings for properties and items.

Spotted in
https://translatewiki.net/wiki/Thread:Support/About_MediaWiki:Wikibase-anonymouseditwarning/be-tarask

Change-Id: I1a7def7d44732a8f41205a8c500c1a34de9dd524
---
M repo/Wikibase.i18n.php
M repo/includes/specials/SpecialModifyEntity.php
M repo/includes/specials/SpecialNewItem.php
M repo/includes/specials/SpecialNewProperty.php
M repo/resources/Resources.php
M repo/resources/wikibase.ui.entityViewInit.js
6 files changed, 55 insertions(+), 65 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/13/71613/1

diff --git a/repo/Wikibase.i18n.php b/repo/Wikibase.i18n.php
index 55edd1b..577a0f8 100644
--- a/repo/Wikibase.i18n.php
+++ b/repo/Wikibase.i18n.php
@@ -91,8 +91,10 @@
 
        'wikibase-entityselector-more' => 'more',
 
-       'wikibase-anonymouseditwarning' => "Warning: You are not logged in.
-Your IP address will be recorded in the edit history of this $1.",
+       'wikibase-anonymouseditwarning-item' => "Warning: You are not logged in.
+Your IP address will be recorded in the edit history of this item.",
+       'wikibase-anonymouseditwarning-property' => "Warning: You are not 
logged in.
+Your IP address will be recorded in the edit history of this property.",
        'wikibase-restrictionedit-tooltip-message' => 'This page is protected. 
Editing is not allowed.',
        'wikibase-blockeduser-tooltip-message' => 'You do not have permission 
to edit because your username or IP address has been blocked.',
 
@@ -597,12 +599,10 @@
        'wikibase-copyrighttooltip-acknowledge' => 'Label of the link to not 
show the copyright warning again. A copyright warning is presented to the user 
whenever the user is about to alter any data unless the warning is not 
suppressed permanently by clicking this link.',
        'wikibase-entityselector-more' => 'The entity selector is a user 
interface widget that allows selecting an entity (see [[d:Wikidata:Glossary]]). 
It consists out of an input field and a list of suggestions that is filled 
according to the text typed into the input field. Initially, the list of 
suggestions is filled with a certain number of suggestions. Clicking the link 
labeled with this message will fill the list of suggestions with additional 
suggestions. If there are no additional suggestions or no suggestions at all, 
the link does not show up.
 {{Identical|More}}',
-       'wikibase-anonymouseditwarning' => "Warning message that is displayed 
using the MediaWiki notification system each time the user starts to edit 
something on an entity (see [[d:Wikidata:Glossary]]) page (e.g. by clicking an 
edit button). Basically, the message shall make the user aware that his/her IP 
will be recorded when saving as long as not being logged in.
-
-Parameters:
-* $1 - the entity's name
-
-See also:
+       'wikibase-anonymouseditwarning-item' => "Warning message that is 
displayed using the MediaWiki notification system each time the user starts to 
edit something on an entity (see [[d:Wikidata:Glossary]]) page (e.g. by 
clicking an edit button). Basically, the message shall make the user aware that 
his/her IP will be recorded when saving as long as not being logged in. See 
also:
+* {{msg-mw|Anoneditwarning}}
+* {{msg-mw|Sf autoedit anoneditwarning}}",
+       'wikibase-anonymouseditwarning-property' => "Warning message that is 
displayed using the MediaWiki notification system each time the user starts to 
edit something on an entity (see [[d:Wikidata:Glossary]]) page (e.g. by 
clicking an edit button). Basically, the message shall make the user aware that 
his/her IP will be recorded when saving as long as not being logged in. See 
also:
 * {{msg-mw|Anoneditwarning}}
 * {{msg-mw|Sf autoedit anoneditwarning}}",
        'wikibase-restrictionedit-tooltip-message' => 'When editing a page (a 
data item) is restricted for the current user, this message is displayed in a 
tooltip bubble when hovering a tooltip anchor next to an input element, an edit 
button or any other button (add, save, remove) that might trigger an action 
altering the data item.',
diff --git a/repo/includes/specials/SpecialModifyEntity.php 
b/repo/includes/specials/SpecialModifyEntity.php
index 7a5ab40..de4cade 100644
--- a/repo/includes/specials/SpecialModifyEntity.php
+++ b/repo/includes/specials/SpecialModifyEntity.php
@@ -157,10 +157,7 @@
 
                if ( $this->getUser()->isAnon() ) {
                        $this->showErrorHTML(
-                               $this->msg(
-                                       'wikibase-anonymouseditwarning',
-                                       $this->msg( 'wikibase-entity-item' 
)->text()
-                               )->parse(),
+                               $this->msg( 
'wikibase-anonymouseditwarning-item' )->parse(),
                                'warning'
                        );
                }
@@ -220,26 +217,26 @@
         * @return string
         */
        protected function getFormElements() {
-               $id = $this->entityContent ? 
$this->entityContent->getTitle()->getText() : '';
-               return Html::element(
-                       'label',
-                       array(
-                               'for' => 'wb-setentity-id',
-                               'class' => 'wb-label'
-                       ),
-                       $this->msg( 'wikibase-setentity-id' )->text()
+       $id = $this->entityContent ? 
$this->entityContent->getTitle()->getText() : '';
+       return Html::element(
+               'label',
+               array(
+                       'for' => 'wb-setentity-id',
+                       'class' => 'wb-label'
+               ),
+               $this->msg( 'wikibase-setentity-id' )->text()
+       )
+       . Html::input(
+               'id',
+               $id,
+               'text',
+               array(
+                       'class' => 'wb-input',
+                       'id' => 'wb-setentity-id'
                )
-               . Html::input(
-                       'id',
-                       $id,
-                       'text',
-                       array(
-                               'class' => 'wb-input',
-                               'id' => 'wb-setentity-id'
-                       )
-               )
-               . Html::element( 'br' );
-       }
+       )
+       . Html::element( 'br' );
+}
 
        /**
         * Modifies the entity.
@@ -262,18 +259,18 @@
         * @return string The summary
         */
        protected function getSummary( $key, $value, $i18n ) {
-               list( $counts, $summary, $lang ) = 
Autocomment::formatAutoSummary(
-                       array( $value ),
-                       $this->getLanguage()
-               );
+       list( $counts, $summary, $lang ) = Autocomment::formatAutoSummary(
+               array( $value ),
+               $this->getLanguage()
+       );
 
-               $comment = Autocomment::formatAutoComment(
-                       $i18n,
-                       array( $counts, $key )
-               );
+       $comment = Autocomment::formatAutoComment(
+               $i18n,
+               array( $counts, $key )
+       );
 
-               return AutoComment::formatTotalSummary( $comment, $summary, 
$lang );
-       }
+       return AutoComment::formatTotalSummary( $comment, $summary, $lang );
+}
 
        /**
         * Output an error message telling the user that he is blocked
@@ -291,10 +288,10 @@
         * @since 0.4
         */
        public function checkBlocked() {
-               if ( $this->getUser()->isBlocked() ) {
-                       $this->displayBlockedError();
-               }
+       if ( $this->getUser()->isBlocked() ) {
+               $this->displayBlockedError();
        }
+}
 
        /**
         * Show the rights warning message
@@ -302,13 +299,13 @@
         * @since 0.4
         */
        public function showRightsMessage() {
-               $this->showErrorHTML(
-                       Html::rawElement(
-                               'p',
-                               array(),
-                               Utils::getRightsWarningMessage()->parse()
-                       ),
-                       'warning'
-               );
-       }
+       $this->showErrorHTML(
+               Html::rawElement(
+                       'p',
+                       array(),
+                       Utils::getRightsWarningMessage()->parse()
+               ),
+               'warning'
+       );
+}
 }
diff --git a/repo/includes/specials/SpecialNewItem.php 
b/repo/includes/specials/SpecialNewItem.php
index 5950cab..578a4e6 100644
--- a/repo/includes/specials/SpecialNewItem.php
+++ b/repo/includes/specials/SpecialNewItem.php
@@ -177,10 +177,7 @@
                $warnings = array();
 
                if ( $this->getUser()->isAnon() ) {
-                       $warnings[] = $this->msg(
-                               'wikibase-anonymouseditwarning',
-                               $this->msg( 'wikibase-entity-item' )
-                       );
+                       $warnings[] = $this->msg( 
'wikibase-anonymouseditwarning-item' );
                }
 
                return $warnings;
diff --git a/repo/includes/specials/SpecialNewProperty.php 
b/repo/includes/specials/SpecialNewProperty.php
index bc1e159..37cdd06 100644
--- a/repo/includes/specials/SpecialNewProperty.php
+++ b/repo/includes/specials/SpecialNewProperty.php
@@ -137,10 +137,7 @@
                $warnings = array();
 
                if ( $this->getUser()->isAnon() ) {
-                       $warnings[] = $this->msg(
-                               'wikibase-anonymouseditwarning',
-                               $this->msg( 'wikibase-entity-property' )
-                       );
+                       $warnings[] = $this->msg( 
'wikibase-anonymouseditwarning-property' );
                }
 
                return $warnings;
diff --git a/repo/resources/Resources.php b/repo/resources/Resources.php
index b3daed2..d2d8752 100644
--- a/repo/resources/Resources.php
+++ b/repo/resources/Resources.php
@@ -56,7 +56,8 @@
                                'wikibase-sitelinks-wikipedia',
                                'wikibase-statements',
                                'wikibase-copyrighttooltip-acknowledge',
-                               'wikibase-anonymouseditwarning',
+                               'wikibase-anonymouseditwarning-item',
+                               'wikibase-anonymouseditwarning-property',
                                'wikibase-entity-item',
                                'wikibase-entity-property',
                        )
diff --git a/repo/resources/wikibase.ui.entityViewInit.js 
b/repo/resources/wikibase.ui.entityViewInit.js
index 8228eea..a1d0fe0 100644
--- a/repo/resources/wikibase.ui.entityViewInit.js
+++ b/repo/resources/wikibase.ui.entityViewInit.js
@@ -203,9 +203,7 @@
                        // Display anonymous user edit warning:
                        if ( mw.user && mw.user.isAnon() ) {
                                mw.notify(
-                                       mw.msg( 'wikibase-anonymouseditwarning',
-                                               mw.msg( 'wikibase-entity-' + 
wb.entity.getType() )
-                                       )
+                                       mw.msg( 'wikibase-anonymouseditwarning' 
+ wb.entity.getType() )
                                );
                        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1a7def7d44732a8f41205a8c500c1a34de9dd524
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
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