Skip to content

Commit a798683

Browse files
committed
use message format
Signed-off-by: nabim777 <[email protected]>
1 parent 4a54d65 commit a798683

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/constants/messages.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ export const messages = {
2020
externalOIDCProvider: t(APP_ID, 'External Provider'),
2121
tokenExchangeHintText: t(APP_ID, 'When enabled, the app will try to obtain a token for the given audience from the identity provider. If disabled, it will use the access token obtained during the login process.'),
2222
opRequiredVersionAndPlanHint: t(APP_ID, 'Requires OpenProject version {version} (or higher) and an active Corporate plan.', { version: OPENPROJECT_VERSION }),
23+
pleaseSelectProject: t(APP_ID, 'Please select a project'),
2324
}
2425

2526
export const messagesFmt = {
2627
appNotEnabledOrUnsupported: (app, version) => t(APP_ID, 'This feature requires version {version} (or higher) of "{app}" app. Please install or update the app.', { app, version }),
2728
configureOIDCProviders: (settingsLink) => t(APP_ID, 'You can configure OIDC providers in the {settingsLink}', { settingsLink }, null, { escape: false, sanitize: false }),
29+
noMachingFound: (fieldName) => t(APP_ID, 'No matching {fieldName} found!', { fieldName }),
2830
}

src/views/CreateWorkPackageModal.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ import { loadState } from '@nextcloud/initial-state'
171171
import { translate as t } from '@nextcloud/l10n'
172172
import { STATE } from '../utils.js'
173173
import debounce from 'lodash/debounce.js'
174+
import { messages, messagesFmt } from '../constants/messages.js'
174175
175176
const SEARCH_CHAR_LIMIT = 1
176177
const DEBOUNCE_THRESHOLD = 500
@@ -303,7 +304,7 @@ export default {
303304
},
304305
getNoOptionTextForProject() {
305306
if (this.availableProjects.length === 0) {
306-
return t('integration_openproject', 'No matching work projects found!')
307+
return messagesFmt.noMachingFound('project')
307308
}
308309
// while projects are being searched we make the no text option empty
309310
return ''
@@ -618,9 +619,9 @@ export default {
618619
},
619620
getNoOptionText(fieldName) {
620621
if (this.project.label === null) {
621-
return t('integration_openproject', 'Please select a project first!')
622+
return messages.pleaseSelectProject
622623
}
623-
return t('integration_openproject', `No matching ${fieldName} found!`)
624+
return messagesFmt.noMachingFound(fieldName)
624625
},
625626
async setAvailableAssigneesForProject(projectId) {
626627
this.availableAssignees = []

0 commit comments

Comments
 (0)