jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/385432 )

Change subject: Do not use messages from View-specific dependency in 
HtmlTimeFormatter
......................................................................


Do not use messages from View-specific dependency in HtmlTimeFormatter

valueview-expert-timevalue-calendar-gregorian/julian messages
are defined in data value view values JS library, which is
a dependency of the View component.
In principle, these are not known to the Lib component, as
it is meant to be independent from View component.
Classes in the Lib component should hence only use messages
which are known inside of this component.

Change-Id: I4c893a1ee8f7c9bbe2c962636a16f865757f05f9
---
M lib/i18n/en.json
M lib/i18n/qqq.json
M lib/includes/Formatters/HtmlTimeFormatter.php
M lib/tests/phpunit/Formatters/HtmlTimeFormatterTest.php
4 files changed, 18 insertions(+), 14 deletions(-)

Approvals:
  jenkins-bot: Verified
  Thiemo Mättig (WMDE): Looks good to me, approved



diff --git a/lib/i18n/en.json b/lib/i18n/en.json
index f284db5..1e10275 100644
--- a/lib/i18n/en.json
+++ b/lib/i18n/en.json
@@ -77,6 +77,8 @@
        "datatypes-type-tabular-data": "Tabular data",
        "datatypes-type-external-id": "External identifier",
        "version-wikibase": "Wikibase",
+       "wikibase-time-calendar-gregorian": "Gregorian",
+       "wikibase-time-calendar-julian": "Julian",
        "wikibase-time-precision-Gannum": "$1 billion years CE",
        "wikibase-time-precision-Mannum": "$1 million years CE",
        "wikibase-time-precision-annum": "{{PLURAL:$1|$1 year|$1 years}} CE",
diff --git a/lib/i18n/qqq.json b/lib/i18n/qqq.json
index b16efe5..9797653 100644
--- a/lib/i18n/qqq.json
+++ b/lib/i18n/qqq.json
@@ -88,6 +88,8 @@
        "datatypes-type-tabular-data": "The name of a data type for 
tabular-data\n{{Identical|Tabular data}}",
        "datatypes-type-external-id": "The name of a data type for external 
identifiers in Wikibase.",
        "version-wikibase": "Name of the Wikibase extension collection, used on 
[[Special:Version]]",
+       "wikibase-time-calendar-gregorian": "Label displayed with the formatted 
dates referring to the Gregorian calendar model.\n{{Identical|Gregorian}}",
+       "wikibase-time-calendar-julian": "Label displayed with the formatted 
dates referring to the Julian calendar model.\n{{Identical|Julian}}",
        "wikibase-time-precision-Gannum": "Used to present a point in time with 
the precession of 1 billion of years. $1 is the point in time in billion years, 
rounded to billion years.\n{{Related|Wikibase-time-precision}}",
        "wikibase-time-precision-Mannum": "Used to present a point in time with 
the precession of 1 million of years. $1 is the point in time in million years, 
rounded to million years.\n{{Related|Wikibase-time-precision}}",
        "wikibase-time-precision-annum": "Used to present a point in time with 
the precession of 10000 years to 100000 years. $1 is the point in time in 
years, rounded to 10000 or 100000 years.\n{{Related|Wikibase-time-precision}}",
diff --git a/lib/includes/Formatters/HtmlTimeFormatter.php 
b/lib/includes/Formatters/HtmlTimeFormatter.php
index c5129fc..5d2b891 100644
--- a/lib/includes/Formatters/HtmlTimeFormatter.php
+++ b/lib/includes/Formatters/HtmlTimeFormatter.php
@@ -25,8 +25,8 @@
 class HtmlTimeFormatter extends ValueFormatterBase {
 
        private static $calendarKeys = [
-               TimeValue::CALENDAR_GREGORIAN => 
'valueview-expert-timevalue-calendar-gregorian',
-               TimeValue::CALENDAR_JULIAN => 
'valueview-expert-timevalue-calendar-julian',
+               TimeValue::CALENDAR_GREGORIAN => 
'wikibase-time-calendar-gregorian',
+               TimeValue::CALENDAR_JULIAN => 'wikibase-time-calendar-julian',
        ];
 
        /**
diff --git a/lib/tests/phpunit/Formatters/HtmlTimeFormatterTest.php 
b/lib/tests/phpunit/Formatters/HtmlTimeFormatterTest.php
index 8208cf1..b8bd427 100644
--- a/lib/tests/phpunit/Formatters/HtmlTimeFormatterTest.php
+++ b/lib/tests/phpunit/Formatters/HtmlTimeFormatterTest.php
@@ -79,13 +79,13 @@
                                '+1520-05-01T00:00:00Z',
                                TimeValue::PRECISION_DAY,
                                $gregorian,
-                               'MOCKDATE<sup 
class="wb-calendar-name">(valueview-expert-timevalue-calendar-gregorian)</sup>'
+                               'MOCKDATE<sup 
class="wb-calendar-name">(wikibase-time-calendar-gregorian)</sup>'
                        ],
                        'a gregorian month in 1520' => [
                                '+1520-05-01T00:00:00Z',
                                TimeValue::PRECISION_MONTH,
                                $gregorian,
-                               'MOCKDATE<sup 
class="wb-calendar-name">(valueview-expert-timevalue-calendar-gregorian)</sup>'
+                               'MOCKDATE<sup 
class="wb-calendar-name">(wikibase-time-calendar-gregorian)</sup>'
                        ],
                        'a julian day in 1520' => [
                                '+1520-05-01T00:00:00Z',
@@ -97,19 +97,19 @@
                                '+1920-05-01T00:00:00Z',
                                TimeValue::PRECISION_DAY,
                                $gregorian,
-                               'MOCKDATE<sup 
class="wb-calendar-name">(valueview-expert-timevalue-calendar-gregorian)</sup>'
+                               'MOCKDATE<sup 
class="wb-calendar-name">(wikibase-time-calendar-gregorian)</sup>'
                        ],
                        'a julian day in 1920' => [
                                '+1920-05-01T00:00:00Z',
                                TimeValue::PRECISION_DAY,
                                $julian,
-                               'MOCKDATE<sup 
class="wb-calendar-name">(valueview-expert-timevalue-calendar-julian)</sup>'
+                               'MOCKDATE<sup 
class="wb-calendar-name">(wikibase-time-calendar-julian)</sup>'
                        ],
                        'a julian day in 1980' => [
                                '+1980-05-01T00:00:00Z',
                                TimeValue::PRECISION_DAY,
                                $julian,
-                               'MOCKDATE<sup 
class="wb-calendar-name">(valueview-expert-timevalue-calendar-julian)</sup>'
+                               'MOCKDATE<sup 
class="wb-calendar-name">(wikibase-time-calendar-julian)</sup>'
                        ],
                        'a gregorian day in 1980' => [
                                '+1980-05-01T00:00:00Z',
@@ -122,7 +122,7 @@
                                '-1000000-00-00T00:00:00Z',
                                TimeValue::PRECISION_YEAR,
                                $gregorian,
-                               'MOCKDATE<sup 
class="wb-calendar-name">(valueview-expert-timevalue-calendar-gregorian)</sup>'
+                               'MOCKDATE<sup 
class="wb-calendar-name">(wikibase-time-calendar-gregorian)</sup>'
                        ],
                        'a julian year in -1000000' => [
                                '-1000000-05-01T00:00:00Z',
@@ -134,7 +134,7 @@
                                '+1520-05-01T00:00:00Z',
                                TimeValue::PRECISION_YEAR,
                                $gregorian,
-                               'MOCKDATE<sup 
class="wb-calendar-name">(valueview-expert-timevalue-calendar-gregorian)</sup>'
+                               'MOCKDATE<sup 
class="wb-calendar-name">(wikibase-time-calendar-gregorian)</sup>'
                        ],
                        'a julian year in 1520' => [
                                '+1520-05-01T00:00:00Z',
@@ -152,13 +152,13 @@
                                '+1920-05-01T00:00:00Z',
                                TimeValue::PRECISION_YEAR,
                                $julian,
-                               'MOCKDATE<sup 
class="wb-calendar-name">(valueview-expert-timevalue-calendar-julian)</sup>'
+                               'MOCKDATE<sup 
class="wb-calendar-name">(wikibase-time-calendar-julian)</sup>'
                        ],
                        'a julian year in 1980' => [
                                '+1980-05-01T00:00:00Z',
                                TimeValue::PRECISION_YEAR,
                                $julian,
-                               'MOCKDATE<sup 
class="wb-calendar-name">(valueview-expert-timevalue-calendar-julian)</sup>'
+                               'MOCKDATE<sup 
class="wb-calendar-name">(wikibase-time-calendar-julian)</sup>'
                        ],
                        'do not enforce calendar model on rough precisions' => [
                                '+1980-05-01T00:00:00Z',
@@ -209,13 +209,13 @@
                                '-1-01-01T00:00:00Z',
                                TimeValue::PRECISION_DAY,
                                $gregorian,
-                               'MOCKDATE<sup 
class="wb-calendar-name">(valueview-expert-timevalue-calendar-gregorian)</sup>'
+                               'MOCKDATE<sup 
class="wb-calendar-name">(wikibase-time-calendar-gregorian)</sup>'
                        ],
                        '32-bit integer overflow' => [
                                '-2147483649-01-01T00:00:00Z',
                                TimeValue::PRECISION_DAY,
                                $gregorian,
-                               'MOCKDATE<sup 
class="wb-calendar-name">(valueview-expert-timevalue-calendar-gregorian)</sup>'
+                               'MOCKDATE<sup 
class="wb-calendar-name">(wikibase-time-calendar-gregorian)</sup>'
                        ],
                        'unknown calendar model' => [
                                '+2015-01-01T00:00:00Z',
@@ -233,7 +233,7 @@
                                'MOCKTIME',
                                TimeValue::PRECISION_DAY,
                                $gregorian,
-                               'MOCKDATE<sup 
class="wb-calendar-name">(valueview-expert-timevalue-calendar-gregorian)</sup>'
+                               'MOCKDATE<sup 
class="wb-calendar-name">(wikibase-time-calendar-gregorian)</sup>'
                        ],
                        'HTML entities' => [
                                '<a>injection</a>',

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I4c893a1ee8f7c9bbe2c962636a16f865757f05f9
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: WMDE-leszek <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: WMDE-leszek <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to