mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Attempt to implement date-fns internalization
This commit is contained in:
parent
cbe3cbe221
commit
1656e73adf
3 changed files with 17 additions and 2 deletions
|
@ -114,3 +114,14 @@ var polyfill = require("@babel/polyfill/dist/polyfill");
|
||||||
_define("polyfill", function () {
|
_define("polyfill", function () {
|
||||||
return polyfill;
|
return polyfill;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Date-FNS
|
||||||
|
var date_fns = require("date-fns");
|
||||||
|
_define("date-fns", function () {
|
||||||
|
return date_fns;
|
||||||
|
});
|
||||||
|
|
||||||
|
var date_fns_locale = require("date-fns/locale");
|
||||||
|
_define("date-fns/locale", function () {
|
||||||
|
return date_fns_locale;
|
||||||
|
});
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
define(["jQuery", "loading", "events", "globalize", "serverNotifications", "humanedate", "listViewStyle", "emby-button"], function($, loading, events, globalize, serverNotifications) {
|
import { es } from 'date-fns/locale'
|
||||||
|
define(["jQuery", "loading", "events", "globalize", "serverNotifications", "date-fns", "listViewStyle", "emby-button"], function($, loading, events, globalize, serverNotifications, datefns) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
function reloadList(page) {
|
function reloadList(page) {
|
||||||
|
@ -66,7 +67,8 @@ define(["jQuery", "loading", "events", "globalize", "serverNotifications", "huma
|
||||||
var html = "";
|
var html = "";
|
||||||
if (task.State === "Idle") {
|
if (task.State === "Idle") {
|
||||||
if (task.LastExecutionResult) {
|
if (task.LastExecutionResult) {
|
||||||
html += globalize.translate("LabelScheduledTaskLastRan", humaneDate(task.LastExecutionResult.EndTimeUtc), humaneElapsed(task.LastExecutionResult.StartTimeUtc, task.LastExecutionResult.EndTimeUtc));
|
html += globalize.translate("LabelScheduledTaskLastRan", datefns.formatDistanceToNow(Date.parse(task.LastExecutionResult.EndTimeUtc), { addSuffix: true, locale: es }),
|
||||||
|
datefns.formatDistance(Date.parse(task.LastExecutionResult.StartTimeUtc), Date.parse(task.LastExecutionResult.EndTimeUtc), { addSuffix: false, locale: es }));
|
||||||
if (task.LastExecutionResult.Status === "Failed") {
|
if (task.LastExecutionResult.Status === "Failed") {
|
||||||
html += " <span style='color:#FF0000;'>(" + globalize.translate("LabelFailed") + ")</span>";
|
html += " <span style='color:#FF0000;'>(" + globalize.translate("LabelFailed") + ")</span>";
|
||||||
} else if (task.LastExecutionResult.Status === "Cancelled") {
|
} else if (task.LastExecutionResult.Status === "Cancelled") {
|
||||||
|
|
|
@ -619,6 +619,7 @@ var AppInfo = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
require(["mediaSession", "serverNotifications"]);
|
require(["mediaSession", "serverNotifications"]);
|
||||||
|
require(["date-fns", "date-fns/locale"]);
|
||||||
|
|
||||||
if (!browser.tv && !browser.xboxOne) {
|
if (!browser.tv && !browser.xboxOne) {
|
||||||
require(["components/playback/playbackorientation"]);
|
require(["components/playback/playbackorientation"]);
|
||||||
|
@ -738,6 +739,7 @@ var AppInfo = {};
|
||||||
"webcomponents",
|
"webcomponents",
|
||||||
"material-icons",
|
"material-icons",
|
||||||
"jellyfin-noto",
|
"jellyfin-noto",
|
||||||
|
"date-fns",
|
||||||
"page",
|
"page",
|
||||||
"polyfill"
|
"polyfill"
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue