Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix lint errors.
James Coled5efe3de9e1e
diff --git a/resources/assets/v3/js/boot/bootstrap.js b/resources/assets/v3/js/boot/bootstrap.jsindex 1533b07199..bdd4056941 100644--- a/resources/assets/v3/js/boot/bootstrap.js+++ b/resources/assets/v3/js/boot/bootstrap.js@@ -81,11 +81,9 @@ getFreshVariable("lastActivity")store.set("locale", replacedLocale);console.log('Ready with bootstrap for this page.');loadTranslations(replacedLanguage, replacedLocale)- .then(function (t) {- console.log('T is', t);+ .then(function () {window.i18next = i18next;document.getElementById('test-box').innerText = i18next.t("config.html_language", {lng: 'nl-NL'});- console.log('is init here A', i18next.isInitialized,i18next.languages);const event = new Event("firefly-iii-bootstrapped");document.dispatchEvent(event);window.bootstrapped = true;diff --git a/resources/assets/v3/js/pages/accounts/create.js b/resources/assets/v3/js/pages/accounts/create.jsindex f984335299..2b2be1b52e 100644--- a/resources/assets/v3/js/pages/accounts/create.js+++ b/resources/assets/v3/js/pages/accounts/create.js@@ -37,11 +37,11 @@ let create = function () {let direction = event.target.value;if ("credit" === direction) {document.querySelector('label[for="ffInput_opening_balance"]').textContent =- i18next.t("firefly.i_am_owed_amount");+ window.i18next.t("firefly.i_am_owed_amount");}if ("debit" === direction) {document.querySelector('label[for="ffInput_opening_balance"]').textContent =- i18next.t("firefly.i_owe_amount");+ window.i18next.t("firefly.i_owe_amount");}});// also change it the first time arounddiff --git a/resources/assets/v3/js/pages/accounts/edit.js b/resources/assets/v3/js/pages/accounts/edit.jsindex f631a4ec84..19d4761982 100644--- a/resources/assets/v3/js/pages/accounts/edit.js+++ b/resources/assets/v3/js/pages/accounts/edit.js@@ -37,18 +37,18 @@ let edit = function () {let direction = event.target.value;if ("credit" === direction) {document.querySelector('label[for="ffInput_opening_balance"]').textContent =- i18next.t("firefly.i_am_owed_amount");+ window.i18next.t("firefly.i_am_owed_amount");}if ("debit" === direction) {document.querySelector('label[for="ffInput_opening_balance"]').textContent =- i18next.t("firefly.i_owe_amount");+ window.i18next.t("firefly.i_owe_amount");}});// also change it the first time aroundlet direction = el.value;if ("credit" === direction) {document.querySelector('label[for="ffInput_opening_balance"]').textContent =- i18next.t("firefly.i_am_owed_amount");+ window.i18next.t("firefly.i_am_owed_amount");}if ("debit" === direction) {document.querySelector('label[for="ffInput_opening_balance"]').textContent =diff --git a/resources/assets/v3/js/pages/exchange-rates/rates.js b/resources/assets/v3/js/pages/exchange-rates/rates.jsindex 8dd3290043..1c3068011e 100644--- a/resources/assets/v3/js/pages/exchange-rates/rates.js+++ b/resources/assets/v3/js/pages/exchange-rates/rates.js@@ -22,7 +22,7 @@import "../../boot/bootstrap.js";import sidebar from "../../pages/shared/sidebar.js";import dates from "../shared/dates.js";-import format from "date-fns/format";+import {format} from "date-fns/format";import i18next from "i18next";import Post from "../../api/model/exchange-rate/post.js";import Put from "../../api/model/exchange-rate/put.js";@@ -241,7 +241,7 @@ let rates = function () {date: date,rate_id: rate_id,inverse_id: inverse_id,- date_formatted: format(date, this.i18next.t("config.date_time_fns")),+ date_formatted: format(date, window.i18next.t("config.date_time_fns", {lng: window.store.get('locale')}), window.store.get('locale')),date_field: current.attributes.date.substring(0, 10),rate: rate,inverse: "",diff --git a/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js b/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.jsindex ab8861c265..64bece3f4d 100644--- a/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js+++ b/resources/assets/v3/js/pages/transactions/shared/create-link-autocomplete.js@@ -24,14 +24,14 @@ import { format } from "date-fns";export function createLinkAutocomplete(fieldIdentifier, url) {let token = document.querySelector('meta[name="csrf-token"]').getAttribute("content");-+ let locale = window.store.get('locale');const renderJournal = function (item) {return (item.description +'<br><small class="text-muted">' +formatMoney(item.amount, item.currency_code) +" @ " +- format(new Date(item.date), this.i18next.t("config.date_time_fns")) ++ format(new Date(item.date), window.i18next.t("config.date_time_fns", {lng: locale}), locale) +"</small>");};diff --git a/resources/assets/v3/js/pages/transactions/show.js b/resources/assets/v3/js/pages/transactions/show.jsindex 3f8d40fd46..968bd3d226 100644--- a/resources/assets/v3/js/pages/transactions/show.js+++ b/resources/assets/v3/js/pages/transactions/show.js@@ -46,6 +46,9 @@ let show = function () {this.downloadTransactionGroup();},downloadTransactionGroup() {++ let locale = window.store.get('locale');+new Get().show(this.group.id).then((response) => {const info = response.data.data;this.group.group_title = info.attributes.group_title;@@ -54,7 +57,7 @@ let show = function () {if (Object.hasOwn(info.attributes.transactions, i)) {let current = info.attributes.transactions[i];current.dateObject = new Date(current.date);- current.dateFormatted = format(current.dateObject, this.i18next.t("config.date_time_fns"));+ current.dateFormatted = format(current.dateObject, window.i18next.t("config.date_time_fns", {lng: locale}), locale);console.log("Date formatted is", current.dateFormatted);this.group.transactions.push(current);}diff --git a/resources/assets/v3/js/pages/webhooks/show.js b/resources/assets/v3/js/pages/webhooks/show.jsindex a39c151c08..1ccfb2ab37 100644--- a/resources/assets/v3/js/pages/webhooks/show.js+++ b/resources/assets/v3/js/pages/webhooks/show.js@@ -21,7 +21,7 @@import "../../boot/bootstrap.js";import sidebar from "../../pages/shared/sidebar.js";import dates from "../shared/dates.js";-import format from "date-fns/format";+import {format} from "date-fns/format";import i18next from "i18next";import Post from "../../api/model/webhook/post.js";import Get from "../../api/model/webhook/get.js";@@ -110,6 +110,7 @@ let show = function () {});},downloadWebhookMessages: function () {+ let locale = window.store.get('locale');this.messages = [];new Get().messages(this.id, {}).then((response) => {for (let i in response.data.data) {@@ -119,7 +120,8 @@ let show = function () {id: current.id,created_at: format(new Date(current.attributes.created_at),- i18next.t("config.date_time_fns"),+ i18next.t("config.date_time_fns", {lng: locale}),+ locale),uuid: current.attributes.uuid,success: current.attributes.sent && !current.attributes.errored,diff --git a/resources/assets/v3/js/shared/draw-chart.js b/resources/assets/v3/js/shared/draw-chart.jsindex 7a65eb53e3..8e73a48c0f 100644--- a/resources/assets/v3/js/shared/draw-chart.js+++ b/resources/assets/v3/js/shared/draw-chart.js@@ -340,6 +340,7 @@ function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker, col// find the place to set the "today" marker, and get FIRST y-axis ID.firstScale = "y" + currentCurrencyCode;labelCount = 0;+ let locale = window.store.get("locale");if (0 === i) {for (let j in current[currentEntryKey]) {if (Object.hasOwn(current[currentEntryKey], j)) {@@ -352,7 +353,7 @@ function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker, coldrawTodayIndex = labelCount;}// add the label to the array- data.labels.push(format(date, window.i18next.t("config.month_and_day_fns", {lng: window.store.get('locale')})));+ data.labels.push(format(date, i18next.t("config.month_and_day_fns", {lng: locale}), locale));}}}@@ -433,9 +434,8 @@ function drawMultiCurrencyLineChart(url, holder, anonymous, drawTodayMarker, colif (drawTodayMarker && "" !== drawTodayLabel) {let locale = window.store.get('locale');let language = window.store.get('language');- console.log('is init here B', window.i18next.isInitialized,window.i18next.languages);- let markDate = format(new Date(drawTodayLabel), window.i18next.t("config.month_and_day_fns", {lng: locale}), locale);- let today = window.i18next.t("firefly.today", {lng: language});+ let markDate = format(new Date(drawTodayLabel), i18next.t("config.month_and_day_fns", {lng: locale}), locale);+ let today = i18next.t("firefly.today", {lng: language});let xAdjust = 0;if (drawTodayIndex < 3) {xAdjust = today.length * 4;diff --git a/resources/assets/v3/js/support/get-viewrange.js b/resources/assets/v3/js/support/get-viewrange.jsindex aa56ff83b1..2f3ba7b98f 100644--- a/resources/assets/v3/js/support/get-viewrange.js+++ b/resources/assets/v3/js/support/get-viewrange.js@@ -28,7 +28,6 @@ import {endOfMonth,endOfQuarter,endOfWeek,- format,startOfDay,startOfMonth,startOfQuarter,