jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/329635 )
Change subject: Made strings "name" and "badges" translatable
..
Made strings "name" and "badges" translatable
Strings "name" and "badges" has been made translatable in Item Diff page.
Bug: T111016
Change-Id: I2f53b0e99c72a066599c1117a29541606991930a
---
M repo/i18n/en.json
M repo/i18n/qqq.json
M repo/includes/Diff/DiffView.php
M repo/includes/Diff/EntityDiffVisualizer.php
M repo/tests/phpunit/includes/Diff/EntityDiffVisualizerTest.php
5 files changed, 41 insertions(+), 12 deletions(-)
Approvals:
Ladsgroup: Looks good to me, approved
jenkins-bot: Verified
Thiemo Mättig (WMDE): Looks good to me, but someone else must approve
diff --git a/repo/i18n/en.json b/repo/i18n/en.json
index 89a388f..e320726 100644
--- a/repo/i18n/en.json
+++ b/repo/i18n/en.json
@@ -62,6 +62,8 @@
"wikibase-diffview-alias": "aliases",
"wikibase-diffview-description": "description",
"wikibase-diffview-link": "links",
+ "wikibase-diffview-link-name": "name",
+ "wikibase-diffview-link-badges": "badges",
"wikibase-sitelink-site-edit-placeholder": "wiki",
"wikibase-sitelink-page-edit-placeholder": "page",
"wikibase-alias-edit-placeholder": "enter an alias",
diff --git a/repo/i18n/qqq.json b/repo/i18n/qqq.json
index 018dc7d..a0c5c74 100644
--- a/repo/i18n/qqq.json
+++ b/repo/i18n/qqq.json
@@ -92,7 +92,9 @@
"wikibase-diffview-label": "Sub heading for label changes in a
diff.\n{{Identical|Label}}",
"wikibase-diffview-alias": "Sub heading for alias changes in a
diff\n{{Identical|Alias}}",
"wikibase-diffview-description": "Sub heading for description changes
in a diff.\n{{Identical|Description}}",
- "wikibase-diffview-link": "Sub heading for link changes in a
diff.\n{{Identical|Link}}",
+ "wikibase-diffview-link": "Sub heading for sitelink changes in a
diff.\n{{Identical|Link}}",
+ "wikibase-diffview-link-name": "Sub heading for changes to the name of
a sitelink in a diff.",
+ "wikibase-diffview-link-badges": "Sub heading for changes to the badges
of a sitelink in a diff.",
"wikibase-sitelink-site-edit-placeholder": "[[File:Screenshot
WikidataRepo 2012-05-13 E.png|right|0x150px]]\nThis is a generic text used as a
placeholder while defining the site for a new sitelink. See also the Wikidata
glossary on [[d:Wikidata:Glossary#sitelink|sitelink]].\n{{Identical|Wiki}}",
"wikibase-sitelink-page-edit-placeholder": "[[File:Screenshot
WikidataRepo 2012-05-13 E.png|right|0x150px]]\nThis is a generic text used as a
placeholder while defining the page for a possibly new sitelink. See also the
Wikidata glossary on
[[d:Wikidata:Glossary#sitelink|sitelink]].\n{{Identical|Page}}",
"wikibase-alias-edit-placeholder": "This is a generic placeholder
message used while editing the list of aliases of an item. It is displayed in
an empty input box which can be used to define a new alias.",
diff --git a/repo/includes/Diff/DiffView.php b/repo/includes/Diff/DiffView.php
index b59d0ac..317bac5 100644
--- a/repo/includes/Diff/DiffView.php
+++ b/repo/includes/Diff/DiffView.php
@@ -52,6 +52,11 @@
private $entityIdFormatter;
/**
+* @var string
+*/
+ private $siteLinkPath;
+
+ /**
* @since 0.1
*
* @param string[] $path
@@ -75,6 +80,8 @@
if ( !is_null( $contextSource ) ) {
$this->setContext( $contextSource );
}
+
+ $this->siteLinkPath = $this->msg( 'wikibase-diffview-link'
)->text();
}
/**
@@ -99,7 +106,17 @@
*/
private function generateOpHtml( array $path, DiffOp $op ) {
if ( $op->isAtomic() ) {
- $html = $this->generateDiffHeaderHtml( implode( ' / ',
$path ) );
+ $localizedPath = $path;
+
+ if ( $this->isSiteLinkPath( $path ) && isset( $path[2]
) ) {
+ $translatedLinkSubPath = $this->msg(
'wikibase-diffview-link-' . $path[2] );
+
+ if ( !$translatedLinkSubPath->isDisabled() ) {
+ $localizedPath[2] =
$translatedLinkSubPath->text();
+ }
+ }
+
+ $html = $this->generateDiffHeaderHtml( implode( ' / ',
$localizedPath ) );
//TODO: no path, but localized section title
@@ -188,7 +205,7 @@
*/
private function getChangedLine( $tag, $value, array $path ) {
// @todo: inject a formatter instead of doing special cases
based on the path here!
- if ( $path[0] === $this->getLanguage()->getMessage(
'wikibase-diffview-link' ) ) {
+ if ( $this->isSiteLi