Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use t for translations #2049

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading