Skip to content

Commit

Permalink
Merge pull request #2049 from nextcloud/artonge/fix/translations
Browse files Browse the repository at this point in the history
Use t for translations
  • Loading branch information
artonge authored Sep 15, 2023
2 parents 6884f4d + a8c278c commit d07560b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion js/photos-main.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-public.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/services/Albums.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/services/collectionFetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down
26 changes: 13 additions & 13 deletions src/store/collections.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand All @@ -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 }))
}
},

Expand Down Expand Up @@ -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
}
},
Expand Down Expand Up @@ -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
}
},
Expand All @@ -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 }))
}
},
}
Expand Down

0 comments on commit d07560b

Please sign in to comment.