Skip to content

Commit

Permalink
Pagination localisation clean-up (matomo-org#14157)
Browse files Browse the repository at this point in the history
* Range start should be one-based, like the range end

* Clean up pagination translation

* Restore ScheduledReports translations

* Update screenshots

* Revert changes to non-English translations

* Update screenshots

* Update screenshot

* Replace UsersManager_XtoYofN with General_Pagination

* Only remove translation from en.json.

* Off by one

* Update screenshots

* Fix off-by-one in range end

* Update screenshots

* Updated screenshot
  • Loading branch information
c960657 authored and diosmosis committed Mar 12, 2019
1 parent 7edf461 commit f613456
Show file tree
Hide file tree
Showing 126 changed files with 256 additions and 244 deletions.
4 changes: 2 additions & 2 deletions lang/en.json
Expand Up @@ -327,8 +327,8 @@
"OverlayRowActionTooltipTitle": "Open Page Overlay",
"Overview": "Overview",
"Pages": "Pages",
"Pagination": "%1$s - %2$s of %3$s",
"PaginationWithoutTotal": "%1$s - %2$s",
"Pagination": "%1$s%2$s of %3$s",
"PaginationWithoutTotal": "%1$s%2$s",
"ParameterMustIntegerBetween": "Parameter %1$s must be an integer value between %2$s and %3$s.",
"Password": "Password",
"Period": "Period",
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion plugins/CoreHome/CoreHome.php
Expand Up @@ -315,6 +315,7 @@ public function getClientSideTranslationKeys(&$translationKeys)
$translationKeys[] = 'General_Hide';
$translationKeys[] = 'General_Save';
$translationKeys[] = 'General_Website';
$translationKeys[] = 'General_Pagination';
$translationKeys[] = 'General_RowsToDisplay';
$translationKeys[] = 'Intl_Year_Short';
$translationKeys[] = 'General_MultiSitesSummary';
Expand All @@ -327,7 +328,6 @@ public function getClientSideTranslationKeys(&$translationKeys)
$translationKeys[] = 'CoreHome_DataTableIncludeAggregateRows';
$translationKeys[] = 'CoreHome_DataTableExcludeAggregateRows';
$translationKeys[] = 'CoreHome_Default';
$translationKeys[] = 'CoreHome_PageOf';
$translationKeys[] = 'CoreHome_FormatMetrics';
$translationKeys[] = 'CoreHome_ShowExportUrl';
$translationKeys[] = 'CoreHome_HideExportUrl';
Expand Down
2 changes: 1 addition & 1 deletion plugins/CoreHome/javascripts/dataTable.js
Expand Up @@ -941,7 +941,7 @@ $.extend(DataTable.prototype, UIControl.prototype, {

// only show this string if there is some rows in the datatable
if (totalRows != 0) {
var str = sprintf(_pk_translate('CoreHome_PageOf'), offset + '-' + offsetEndDisp, totalRows);
var str = sprintf(_pk_translate('General_Pagination'), offset, offsetEndDisp, totalRows);
$(this).text(str);
} else {
$(this).hide();
Expand Down
1 change: 0 additions & 1 deletion plugins/CoreHome/lang/en.json
Expand Up @@ -47,7 +47,6 @@
"Menu": "Menu",
"NoPrivilegesAskPiwikAdmin": "You are logged in as '%1$s' but it seems you don't have any permission set in Matomo. %2$s Ask your Matomo administrator (click to email)%3$s to give you 'view' access to a website.",
"OnlyForSuperUserAccess": "This widget is displayed in the default dashboard only to users having Super User access.",
"PageOf": "%1$s of %2$s",
"PeriodRange": "Range",
"ReportGeneratedOn": "Report generated on %s",
"ReportGeneratedXAgo": "Report generated %s ago",
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 10 additions & 6 deletions plugins/MultiSites/angularjs/dashboard/dashboard-model.service.js
Expand Up @@ -28,8 +28,8 @@
updateWebsitesList: updateWebsitesList,
getNumberOfFilteredSites: getNumberOfFilteredSites,
getNumberOfPages: getNumberOfPages,
getCurrentPagingOffsetStart: getCurrentPagingOffsetStart,
getCurrentPagingOffsetEnd: getCurrentPagingOffsetEnd,
getPaginationLowerBound: getPaginationLowerBound,
getPaginationUpperBound: getPaginationUpperBound,
previousPage: previousPage,
nextPage: nextPage,
searchSite: searchSite,
Expand Down Expand Up @@ -86,12 +86,16 @@
return Math.ceil(getNumberOfFilteredSites() / model.pageSize - 1);
}

function getCurrentPagingOffsetStart() {
function getCurrentPagingOffset() {
return Math.ceil(model.currentPage * model.pageSize);
}

function getCurrentPagingOffsetEnd() {
var end = getCurrentPagingOffsetStart() + parseInt(model.pageSize, 10);
function getPaginationLowerBound() {
return getCurrentPagingOffset() + 1;
}

function getPaginationUpperBound() {
var end = getCurrentPagingOffset() + parseInt(model.pageSize, 10);
var max = getNumberOfFilteredSites();
if (end > max) {
end = max;
Expand Down Expand Up @@ -145,7 +149,7 @@
hideMetricsDoc: '1',
filter_sort_order: 'asc',
filter_limit: model.pageSize,
filter_offset: getCurrentPagingOffsetStart(),
filter_offset: getCurrentPagingOffset(),
showColumns: 'label,nb_visits,nb_pageviews,visits_evolution,pageviews_evolution,revenue_evolution,nb_actions,revenue'
};

Expand Down
Expand Up @@ -99,7 +99,7 @@
</span>
<span class="dataTablePages">
<span id="counter">
{{ 'General_Pagination'|translate:model.getCurrentPagingOffsetStart():model.getCurrentPagingOffsetEnd():model.getNumberOfFilteredSites() }}
{{ 'General_Pagination'|translate:model.getPaginationLowerBound():model.getPaginationUpperBound():model.getNumberOfFilteredSites() }}
</span>
</span>
<span id="next" class="next dataTableNext" ng-hide="model.currentPage >= model.getNumberOfPages()" ng-click="model.nextPage()">
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -36,8 +36,8 @@
model.sites = sites;

var numSites = sites.length;
model.offsetStart = model.currentPage * model.pageSize;
model.offsetEnd = model.offsetStart + numSites;
model.offsetStart = model.currentPage * model.pageSize + 1;
model.offsetEnd = model.offsetStart + numSites - 1;
model.hasPrev = model.currentPage >= 1;
model.hasNext = numSites === model.pageSize;
}
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion plugins/UsersManager/UsersManager.php
Expand Up @@ -221,6 +221,7 @@ public function getClientSideTranslationKeys(&$translationKeys)
$translationKeys[] = "General_OrCancel";
$translationKeys[] = "General_Save";
$translationKeys[] = "General_Done";
$translationKeys[] = "General_Pagination";
$translationKeys[] = "UsersManager_DeleteConfirm";
$translationKeys[] = "UsersManager_ConfirmGrantSuperUserAccess";
$translationKeys[] = "UsersManager_ConfirmProhibitOtherUsersSuperUserAccess";
Expand Down Expand Up @@ -272,7 +273,6 @@ public function getClientSideTranslationKeys(&$translationKeys)
$translationKeys[] = 'UsersManager_UserSearch';
$translationKeys[] = 'UsersManager_DeleteUsers';
$translationKeys[] = 'UsersManager_FilterByAccess';
$translationKeys[] = 'UsersManager_XtoYofN';
$translationKeys[] = 'UsersManager_Username';
$translationKeys[] = 'UsersManager_RoleFor';
$translationKeys[] = 'UsersManager_TheDisplayedUsersAreSelected';
Expand Down
Expand Up @@ -78,7 +78,7 @@

<div class="counter">
<span>
{{ 'UsersManager_XtoYofN'|translate:$ctrl.searchParams.offset:$ctrl.getPaginationUpperBound():$ctrl.totalEntries }}
{{ 'General_Pagination'|translate:$ctrl.getPaginationLowerBound():$ctrl.getPaginationUpperBound():$ctrl.totalEntries }}
</span>
<div piwik-activity-indicator ng-if="$ctrl.isLoadingUsers" loading="$ctrl.isLoadingUsers"></div>
</div>
Expand Down Expand Up @@ -203,4 +203,4 @@ <h3 ng-if="$ctrl.userToChange && $ctrl.userToChange.login == 'anonymous' && $ctr
<a href="" class="modal-action modal-close modal-no" ng-click="$ctrl.userToChange.role = $ctrl.previousRole; $ctrl.userToChange = null; $ctrl.roleToChangeTo = null;">{{:: 'General_No'|translate }}</a>
</div>
</div>
</div>
</div>
Expand Up @@ -59,6 +59,7 @@
vm.changeUserRole = changeUserRole;
vm.onRowSelected = onRowSelected;
vm.deleteRequestedUsers = deleteRequestedUsers;
vm.getPaginationLowerBound = getPaginationLowerBound;
vm.getPaginationUpperBound = getPaginationUpperBound;
vm.showDeleteConfirm = showDeleteConfirm;
vm.getAffectedUsersCount = getAffectedUsersCount;
Expand Down Expand Up @@ -180,6 +181,10 @@
return result;
}

function getPaginationLowerBound() {
return vm.searchParams.offset + 1;
}

function getPaginationUpperBound() {
return Math.min(vm.searchParams.offset + vm.searchParams.limit, vm.totalEntries);
}
Expand Down
Expand Up @@ -86,7 +86,7 @@

<span class="counter">
<span>
{{ 'UsersManager_XtoYofN'|translate:$ctrl.offset:$ctrl.getPaginationUpperBound():$ctrl.totalEntries }}
{{ 'General_Pagination'|translate:$ctrl.getPaginationLowerBound():$ctrl.getPaginationUpperBound():$ctrl.totalEntries }}
</span>
</span>

Expand Down Expand Up @@ -215,4 +215,4 @@ <h3 piwik-translate="UsersManager_ChangePermToAllSitesConfirm"><strong>{{ $ctrl.
<a href="" class="modal-action modal-close modal-no">{{:: 'General_No'|translate }}</a>
</div>
</div>
</div>
</div>
Expand Up @@ -58,6 +58,7 @@
vm.$onChanges = $onChanges;
vm.onAllCheckboxChange = onAllCheckboxChange;
vm.onRowSelected = onRowSelected;
vm.getPaginationLowerBound = getPaginationLowerBound;
vm.getPaginationUpperBound = getPaginationUpperBound;
vm.fetchAccess = fetchAccess;
vm.gotoPreviousPage = gotoPreviousPage;
Expand Down Expand Up @@ -180,6 +181,10 @@
vm.isAllCheckboxSelected = selectedRowKeyCount === vm.siteAccess.length;
}

function getPaginationLowerBound() {
return vm.offset + 1;
}

function getPaginationUpperBound() {
return Math.min(vm.offset + vm.limit, vm.totalEntries);
}
Expand Down
1 change: 0 additions & 1 deletion plugins/UsersManager/lang/en.json
Expand Up @@ -114,7 +114,6 @@
"ClickToSelectAll": "Click to select all %1$s.",
"AllWebsitesAreSelected": "All %1$s websites are selected.",
"ClickToSelectDisplayedWebsites": "Click to select the %1$s displayed websites.",
"XtoYofN": "%1$s - %2$s of %3$s",
"DeletePermConfirmSingle": "Are you sure you want to remove %1$s's access to %2$s?",
"DeletePermConfirmMultiple": "Are you sure you want to remove %1$s's access the %2$s selected websites?",
"ChangePermToSiteConfirmSingle": "Are you sure you want to change %1$s's role to %2$s to %3$s?",
Expand Down

0 comments on commit f613456

Please sign in to comment.