Skip to content

Commit 6b3c5dd

Browse files
committed
fix translation
Signed-off-by: nabim777 <[email protected]>
1 parent dfec017 commit 6b3c5dd

File tree

3 files changed

+22
-12
lines changed

3 files changed

+22
-12
lines changed

src/constants/messages.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ export const messages = {
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 }),
2323
pleaseSelectProject: t(APP_ID, 'Please select a project'),
24+
noMachingWorkProjectsFound: t(APP_ID, 'No matching work projects found'),
25+
noMachingStausFound: t(APP_ID, 'No matching status found'),
26+
noMachingTypeFound: t(APP_ID, 'No matching type found'),
27+
noMachingAssigneeFound: t(APP_ID, 'No matching assignee found'),
2428
}
2529

2630
export const messagesFmt = {
2731
appNotEnabledOrUnsupported: (app, version) => t(APP_ID, 'This feature requires version {version} (or higher) of "{app}" app. Please install or update the app.', { app, version }),
2832
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 }),
3033
}

src/views/CreateWorkPackageModal.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +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'
174+
import { messages } from '../constants/messages.js'
175175
176176
const SEARCH_CHAR_LIMIT = 1
177177
const DEBOUNCE_THRESHOLD = 500
@@ -304,7 +304,7 @@ export default {
304304
},
305305
getNoOptionTextForProject() {
306306
if (this.availableProjects.length === 0) {
307-
return messagesFmt.noMachingFound('work projects')
307+
return messages.noMachingWorkProjectsFound
308308
}
309309
// while projects are being searched we make the no text option empty
310310
return ''
@@ -621,7 +621,14 @@ export default {
621621
if (this.project.label === null) {
622622
return messages.pleaseSelectProject
623623
}
624-
return messagesFmt.noMachingFound(fieldName)
624+
if (fieldName === 'assignee') {
625+
return messages.noMachingAssigneeFound
626+
} else if (fieldName === 'type') {
627+
return messages.noMachingTypeFound
628+
} else if (fieldName === 'status') {
629+
return messages.noMachingStausFound
630+
}
631+
return ''
625632
},
626633
async setAvailableAssigneesForProject(projectId) {
627634
this.availableAssignees = []

tests/jest/views/CreateWorkpackageModal.spec.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import availableProjectAssignees from '../fixtures/availableProjectAssigneesResp
1818
import workpackageCreatedResponse from '../fixtures/workPackageSuccessfulCreationResponse.json'
1919
import requiredTypeResponse from '../fixtures/formValidationResponseRequiredType.json'
2020
import CreateWorkPackageModal from '../../../src/views/CreateWorkPackageModal.vue'
21-
import { messagesFmt, messages } from '../../../src/constants/messages.js'
21+
import { messages } from '../../../src/constants/messages.js'
2222

2323
const localVue = createLocalVue()
2424
jest.mock('@nextcloud/dialogs', () => ({
@@ -133,7 +133,7 @@ describe('CreateWorkPackageModal.vue', () => {
133133
},
134134
)
135135
const searchResult = wrapper.find(firstProjectSelector)
136-
expect(searchResult.text()).toBe(messagesFmt.noMachingFound('work projects'))
136+
expect(searchResult.text()).toBe(messages.noMachingWorkProjectsFound)
137137
})
138138

139139
it.each([
@@ -176,7 +176,7 @@ describe('CreateWorkPackageModal.vue', () => {
176176
},
177177
)
178178
const searchResult = wrapper.find(firstProjectSelector)
179-
expect(searchResult.text()).toBe(messagesFmt.noMachingFound('work projects'))
179+
expect(searchResult.text()).toBe(messages.noMachingWorkProjectsFound)
180180
expect(inputField.element.value).toBe('Scw')
181181

182182
// Trigger blur event (user moves to another field)
@@ -708,21 +708,21 @@ describe('CreateWorkPackageModal.vue', () => {
708708
fieldName: 'type',
709709
inputSelector: typeInputFieldSelector,
710710
resultSelector: firstTypeSelector,
711-
expectedMessage: 'No matching type found',
711+
expectedMessage: messages.noMachingTypeFound,
712712
},
713713
{
714714
fieldName: 'status',
715715
inputSelector: statusInputFieldSelector,
716716
resultSelector: firstStatusSelector,
717-
expectedMessage: 'No matching status found',
717+
expectedMessage: messages.noMachingStausFound,
718718
},
719719
{
720720
fieldName: 'assignee',
721721
inputSelector: assigneeInputFieldSelector,
722722
resultSelector: firstAssigneeSelector,
723-
expectedMessage: 'No matching assignee found',
723+
expectedMessage: messages.noMachingAssigneeFound,
724724
},
725-
])('should show $expectedMessage when project is set and there is no $fieldName found in search query', async ({ fieldName, inputSelector, resultSelector }) => {
725+
])('should show $expectedMessage when project is set and there is no $fieldName found in search query', async ({ inputSelector, resultSelector, expectedMessage }) => {
726726

727727
wrapper = mountWrapper(true, {
728728
project: {
@@ -740,7 +740,7 @@ describe('CreateWorkPackageModal.vue', () => {
740740
await input.trigger('focus')
741741

742742
const searchResult = wrapper.find(resultSelector)
743-
expect(searchResult.text()).toBe(messagesFmt.noMachingFound(fieldName))
743+
expect(searchResult.text()).toBe(expectedMessage)
744744
})
745745
})
746746

0 commit comments

Comments
 (0)