Skip to content

Commit

Permalink
Fix i18n messages for the 'latest' dropdown. Bug: T151439
Browse files Browse the repository at this point in the history
  • Loading branch information
MusikAnimal committed Nov 25, 2016
1 parent e654f4d commit 7c58007
Show file tree
Hide file tree
Showing 13 changed files with 34 additions and 29 deletions.
6 changes: 4 additions & 2 deletions javascripts/shared/chart_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,13 +580,15 @@ const ChartHelpers = superclass => class extends superclass {
$('.date-latest a').on('click', e => {
const value = $(e.target).data('value');
this.setSpecialRange(`latest-${value}`);
$('.latest-num').text(value);
$('.latest-text').text(
$.i18n('latest-days', value)
);
});

dateRangeSelector.on('change', e => {
this.setChartPointDetectionRadius(); // FIXME: is this needed?
this.processInput();
$('.latest-num').text('');
$('.latest-text').text($.i18n('latest'));

/** clear out specialRange if it doesn't match our input */
if (this.specialRange && this.specialRange.value !== e.target.value) {
Expand Down
4 changes: 3 additions & 1 deletion javascripts/shared/pv.js
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,9 @@ class Pv extends PvConfig {
this.daterangepicker.startDate = startDate;
this.daterangepicker.setEndDate(endDate);

$('.latest-num').text(offset);
$('.latest-text').text(
$.i18n('latest-days', offset)
);

return this.specialRange;
}
Expand Down
2 changes: 1 addition & 1 deletion messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"title": "Pageviews Analysis",
"dates": "Dates",
"latest-days": "Latest $1 days",
"latest-days": "Latest $1",
"last-week": "Last week",
"this-month": "This month",
"last-month": "Last month",
Expand Down
4 changes: 2 additions & 2 deletions messages/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
"title": "The title of the tool. This is shown as a header at the top of the page.",
"dates": "Header for the part of the interface that lets the user select a range of dates\n{{Identical|Date}}",
"latest-days": "These are the 'latest days' links preceeding the date selector. $1 are the individual links. They are not numerical, so <nowiki>{{PLURAL}}</nowiki> cannot not be used on them.",
"latest-days": "Label for the 'latest' dropdown next to the date selector, when a number of days has been specified. $1 is the number of days. The word 'days' should not be included, in order to keep the wording brief.",
"last-week": "Link to set the date range to the last week\n{{Identical|Last week}}",
"this-month": "Link to set the date range to the current month\n{{Identical|This month}}",
"last-month": "Link to set the date range to the last month\n{{Identical|Last month}}",
Expand Down Expand Up @@ -304,7 +304,7 @@
"num-projects-info": "Text indicating the number of projects the user is allowed to enter in the Siteviews application. $1 is the number. Similar to the 'num-pages-info' message.",
"options": "Label for the area of the page to set options for the query.\n{{Identical|Options}}",
"links": "Label for the column that has links to other applications for the page.\n{{Identical|Link}}",
"latest": "Label for the 'latest days' dropdown next to the date selector. This may be followed by a number. The word 'days' should not be included.\n{{Identical|Latest}}",
"latest": "Label for the 'latest' dropdown next to the date selector.\n{{Identical|Latest}}",
"clear": "Label for the link to clear all pages from the page selector.\n{{Identical|Clear}}",
"revisions": "Heading for the list of data about revisions of a page.\n{{Identical|Revision}}",
"basic-information": "Heading for the list of data showing basic information about a page or site.\n{{Identical|Basic information}}",
Expand Down
4 changes: 2 additions & 2 deletions public_html/application.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions public_html/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
</label>
<span class="btn-group dropdown latest-group">
<button class="btn btn-default btn-xs dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<?php echo $I18N->msg( 'latest' ); ?>
<span class="latest-num">30</span>
<span class="latest-text">
<?php echo $I18N->msg( 'latest' ); ?>
</span>
<span class="caret"></span>
</button>
<ul class="dropdown-menu dropdown-menu-right date-latest">
Expand Down
6 changes: 3 additions & 3 deletions public_html/langviews/application.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions public_html/massviews/application.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions public_html/meta/application.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions public_html/redirectviews/application.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions public_html/siteviews/application.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions public_html/topviews/application.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions views/index.haml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
= $I18N->msg( 'dates' )
%span.btn-group.dropdown.latest-group
%button.btn.btn-default.btn-xs.dropdown-toggle(type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false")
= $I18N->msg( 'latest' )
%span.latest-num 30
%span.latest-text
= $I18N->msg( 'latest' )
%span.caret
%ul.dropdown-menu.dropdown-menu-right.date-latest
- foreach ([10, 20, 30, 60, 90] as $offset)
Expand Down

0 comments on commit 7c58007

Please sign in to comment.