mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 10:58:57 +00:00
gui: Allow to translate and fix incorrect Versions date filter ranges (#8162)
* gui: Allow to translate and fix incorrect Versions date filter ranges Translate the previously English-only ranges used in Versions date filter. In the process, fix the currently incorrect range calculation. For instance, let us say it is 08:05. Selecting "today" should set the range to start at 00:00 and end at 08:05. However, what really happens is that both start and end are set to 08:05, and as a result "today" is never shown to the user. The case is the same for "yesterday", which in contrary to "today" is shown, but its range is fixed at 08:05 on the previous day. This commit fixes the above by always calculating "today" starting at 00:00 up to the current moment, and calculating "yesterday" from 00:00 on the previous to 00:00 on the current day. When it comes to "last x days", the commit fixes the calculation so that it actually covers the whole day, which is done by moving the start date to 00:00 on the first day. Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com>
This commit is contained in:
parent
1c74944cca
commit
2738735321
@ -19,6 +19,7 @@
|
||||
"Advanced": "Advanced",
|
||||
"Advanced Configuration": "Advanced Configuration",
|
||||
"All Data": "All Data",
|
||||
"All Time": "All Time",
|
||||
"All folders shared with this device must be protected by a password, such that all sent data is unreadable without the given password.": "All folders shared with this device must be protected by a password, such that all sent data is unreadable without the given password.",
|
||||
"Allow Anonymous Usage Reporting?": "Allow Anonymous Usage Reporting?",
|
||||
"Allowed Networks": "Allowed Networks",
|
||||
@ -66,6 +67,7 @@
|
||||
"Copyright © 2014-2019 the following Contributors:": "Copyright © 2014-2019 the following Contributors:",
|
||||
"Creating ignore patterns, overwriting an existing file at {%path%}.": "Creating ignore patterns, overwriting an existing file at {{path}}.",
|
||||
"Currently Shared With Devices": "Currently Shared With Devices",
|
||||
"Custom Range": "Custom Range",
|
||||
"Danger!": "Danger!",
|
||||
"Debugging Facilities": "Debugging Facilities",
|
||||
"Default Configuration": "Default Configuration",
|
||||
@ -183,6 +185,9 @@
|
||||
"Keep Versions": "Keep Versions",
|
||||
"LDAP": "LDAP",
|
||||
"Largest First": "Largest First",
|
||||
"Last 30 Days": "Last 30 Days",
|
||||
"Last 7 Days": "Last 7 Days",
|
||||
"Last Month": "Last Month",
|
||||
"Last Scan": "Last Scan",
|
||||
"Last seen": "Last seen",
|
||||
"Latest Change": "Latest Change",
|
||||
@ -378,12 +383,14 @@
|
||||
"There are no folders to share with this device.": "There are no folders to share with this device.",
|
||||
"They are retried automatically and will be synced when the error is resolved.": "They are retried automatically and will be synced when the error is resolved.",
|
||||
"This Device": "This Device",
|
||||
"This Month": "This Month",
|
||||
"This can easily give hackers access to read and change any files on your computer.": "This can easily give hackers access to read and change any files on your computer.",
|
||||
"This device cannot automatically discover other devices or announce its own address to be found by others. Only devices with statically configured addresses can connect.": "This device cannot automatically discover other devices or announce its own address to be found by others. Only devices with statically configured addresses can connect.",
|
||||
"This is a major version upgrade.": "This is a major version upgrade.",
|
||||
"This setting controls the free space required on the home (i.e., index database) disk.": "This setting controls the free space required on the home (i.e., index database) disk.",
|
||||
"Time": "Time",
|
||||
"Time the item was last modified": "Time the item was last modified",
|
||||
"Today": "Today",
|
||||
"Trash Can File Versioning": "Trash Can File Versioning",
|
||||
"Type": "Type",
|
||||
"UNIX Permissions": "UNIX Permissions",
|
||||
@ -428,6 +435,7 @@
|
||||
"When adding a new device, keep in mind that this device must be added on the other side too.": "When adding a new device, keep in mind that this device must be added on the other side too.",
|
||||
"When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.": "When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.",
|
||||
"Yes": "Yes",
|
||||
"Yesterday": "Yesterday",
|
||||
"You can also select one of these nearby devices:": "You can also select one of these nearby devices:",
|
||||
"You can change your choice at any time in the Settings dialog.": "You can change your choice at any time in the Settings dialog.",
|
||||
"You can read more about the two release channels at the link below.": "You can read more about the two release channels at the link below.",
|
||||
|
@ -2599,15 +2599,14 @@ angular.module('syncthing.core')
|
||||
$scope.restoreVersions.filters['start'] = minDate;
|
||||
$scope.restoreVersions.filters['end'] = maxDate;
|
||||
|
||||
var ranges = {
|
||||
'All time': [minDate, maxDate],
|
||||
'Today': [moment(), moment()],
|
||||
'Yesterday': [moment().subtract(1, 'days'), moment().subtract(1, 'days')],
|
||||
'Last 7 Days': [moment().subtract(6, 'days'), moment()],
|
||||
'Last 30 Days': [moment().subtract(29, 'days'), moment()],
|
||||
'This Month': [moment().startOf('month'), moment().endOf('month')],
|
||||
'Last Month': [moment().subtract(1, 'month').startOf('month'), moment().subtract(1, 'month').endOf('month')]
|
||||
};
|
||||
var ranges = {};
|
||||
ranges[$translate.instant("All Time")] = [minDate, maxDate];
|
||||
ranges[$translate.instant("Today")] = [moment().startOf('day'), moment()];
|
||||
ranges[$translate.instant("Yesterday")] = [moment().subtract(1, 'days').startOf('day'), moment().startOf('day')];
|
||||
ranges[$translate.instant("Last 7 Days")] = [moment().subtract(6, 'days').startOf('day'), moment()];
|
||||
ranges[$translate.instant("Last 30 Days")] = [moment().subtract(29, 'days').startOf('day'), moment()];
|
||||
ranges[$translate.instant("This Month")] = [moment().startOf('month'), moment()];
|
||||
ranges[$translate.instant("Last Month")] = [moment().subtract(1, 'month').startOf('month'), moment().startOf('month')];
|
||||
|
||||
// Filter out invalid ranges.
|
||||
$.each(ranges, function (key, range) {
|
||||
@ -2628,6 +2627,7 @@ angular.module('syncthing.core')
|
||||
maxDate: maxDate,
|
||||
ranges: ranges,
|
||||
locale: {
|
||||
customRangeLabel: $translate.instant("Custom Range"),
|
||||
format: 'YYYY/MM/DD HH:mm:ss',
|
||||
}
|
||||
}).on('apply.daterangepicker', function (ev, picker) {
|
||||
|
Loading…
Reference in New Issue
Block a user