From 955c1c8bcb7f12968f4134e6e79eccde7a077d07 Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Thu, 14 Sep 2023 10:08:30 +0200 Subject: [PATCH] Use t for translations Signed-off-by: Louis Chemineau --- src/services/Albums.js | 4 ++-- src/services/collectionFetcher.js | 4 ++-- src/store/collections.js | 26 +++++++++++++------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/services/Albums.js b/src/services/Albums.js index 6dd3f1a9f..e1e8e7f6d 100644 --- a/src/services/Albums.js +++ b/src/services/Albums.js @@ -21,7 +21,7 @@ */ import moment from '@nextcloud/moment' -import { translate } from '@nextcloud/l10n' +import { translate as t } from '@nextcloud/l10n' import defaultClient from '../services/DavClient.js' import logger from '../services/logger.js' @@ -151,7 +151,7 @@ function formatAlbum(album) { if (dateRangeFormatted.startDate === dateRangeFormatted.endDate) { album.date = dateRangeFormatted.startDate } else { - album.date = translate('photos', '{startDate} to {endDate}', dateRangeFormatted) + album.date = t('photos', '{startDate} to {endDate}', dateRangeFormatted) } return album diff --git a/src/services/collectionFetcher.js b/src/services/collectionFetcher.js index f1e264251..8f22884f4 100644 --- a/src/services/collectionFetcher.js +++ b/src/services/collectionFetcher.js @@ -21,7 +21,7 @@ */ import moment from '@nextcloud/moment' -import { translate } from '@nextcloud/l10n' +import { translate as t } from '@nextcloud/l10n' import defaultClient from './DavClient.js' import logger from './logger.js' @@ -184,7 +184,7 @@ function formatCollection(rawCollection) { if (dateRangeFormatted.startDate === dateRangeFormatted.endDate) { rawCollection.date = dateRangeFormatted.startDate } else { - rawCollection.date = translate('photos', '{startDate} to {endDate}', dateRangeFormatted) + rawCollection.date = t('photos', '{startDate} to {endDate}', dateRangeFormatted) } return rawCollection diff --git a/src/store/collections.js b/src/store/collections.js index 9d242db7c..53bf687e9 100644 --- a/src/store/collections.js +++ b/src/store/collections.js @@ -21,7 +21,7 @@ */ import { showError } from '@nextcloud/dialogs' -import { translate } from '@nextcloud/l10n' +import { translate as t } from '@nextcloud/l10n' import client from '../services/DavClient.js' import logger from '../services/logger.js' @@ -199,8 +199,8 @@ const actions = { if (error.response.status !== 409) { // Already in the collection. context.commit('removeFilesFromCollection', { collectionFileName, fileIdsToRemove: [fileId] }) - logger.error(translate('photos', 'Failed to add {fileBaseName} to collection {collectionFileName}.', { fileBaseName: file.basename, collectionFileName }), { error }) - showError(translate('photos', 'Failed to add {fileBaseName} to collection {collectionFileName}.', { fileBaseName: file.basename, collectionFileName })) + logger.error(t('photos', 'Failed to add {fileBaseName} to collection {collectionFileName}.', { fileBaseName: file.basename, collectionFileName }), { error }) + showError(t('photos', 'Failed to add {fileBaseName} to collection {collectionFileName}.', { fileBaseName: file.basename, collectionFileName })) } } finally { semaphore.release(symbol) @@ -233,8 +233,8 @@ const actions = { } catch (error) { context.commit('addFilesToCollection', { collectionFileName, fileIdsToAdd: [fileId] }) - logger.error(translate('photos', 'Failed to delete {fileBaseName}.', { fileBaseName: file.basename }), { error }) - showError(translate('photos', 'Failed to delete {fileBaseName}.', { fileBaseName: file.basename })) + logger.error(t('photos', 'Failed to delete {fileBaseName}.', { fileBaseName: file.basename }), { error }) + showError(t('photos', 'Failed to delete {fileBaseName}.', { fileBaseName: file.basename })) } finally { semaphore.release(symbol) } @@ -256,8 +256,8 @@ const actions = { context.commit('addCollections', { collections: [collection] }) return collection } catch (error) { - logger.error(translate('photos', 'Failed to create {collectionFileName}.', { collectionFileName: collection.filename }), { error }) - showError(translate('photos', 'Failed to create {collectionFileName}.', { collectionFileName: collection.filename })) + logger.error(t('photos', 'Failed to create {collectionFileName}.', { collectionFileName: collection.filename }), { error }) + showError(t('photos', 'Failed to create {collectionFileName}.', { collectionFileName: collection.filename })) } }, @@ -285,8 +285,8 @@ const actions = { return newCollection } catch (error) { context.commit('removeCollections', { collectionFileNames: [newCollection.filename] }) - logger.error(translate('photos', 'Failed to rename {currentCollectionFileName} to {newCollectionFileName}.', { currentCollectionFileName: collectionFileName, newCollectionFileName: newCollection.filename }), { error }) - showError(translate('photos', 'Failed to rename {currentCollectionFileName} to {newCollectionFileName}.', { currentCollectionFileName: collectionFileName, newCollectionFileName: newCollection.filename })) + logger.error(t('photos', 'Failed to rename {currentCollectionFileName} to {newCollectionFileName}.', { currentCollectionFileName: collectionFileName, newCollectionFileName: newCollection.filename }), { error }) + showError(t('photos', 'Failed to rename {currentCollectionFileName} to {newCollectionFileName}.', { currentCollectionFileName: collectionFileName, newCollectionFileName: newCollection.filename })) return collection } }, @@ -342,8 +342,8 @@ const actions = { return updatedCollection } catch (error) { context.commit('updateCollection', { collection }) - logger.error(translate('photos', 'Failed to update properties of {collectionFileName} with {properties}.', { collectionFileName, properties: JSON.stringify(properties) }), { error }) - showError(translate('photos', 'Failed to update properties of {collectionFileName} with {properties}.', { collectionFileName, properties: JSON.stringify(properties) })) + logger.error(t('photos', 'Failed to update properties of {collectionFileName} with {properties}.', { collectionFileName, properties: JSON.stringify(properties) }), { error }) + showError(t('photos', 'Failed to update properties of {collectionFileName} with {properties}.', { collectionFileName, properties: JSON.stringify(properties) })) return collection } }, @@ -361,8 +361,8 @@ const actions = { await client.deleteFile(collection.filename) context.commit('removeCollections', { collectionFileNames: [collectionFileName] }) } catch (error) { - logger.error(translate('photos', 'Failed to delete {collectionFileName}.', { collectionFileName }), { error }) - showError(translate('photos', 'Failed to delete {collectionFileName}.', { collectionFileName })) + logger.error(t('photos', 'Failed to delete {collectionFileName}.', { collectionFileName }), { error }) + showError(t('photos', 'Failed to delete {collectionFileName}.', { collectionFileName })) } }, }