Skip to content

Commit e11e1d7

Browse files
Merge pull request #106 from damonsan/feature_i18n_project_component_type
Extracted component hardcoded labels in project creation to i18n labels.
2 parents 9e6fe6d + c6db313 commit e11e1d7

File tree

3 files changed

+27
-11
lines changed

3 files changed

+27
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ for this scenario, simply change the value of API_BASE_URL in static/config.json
8383

8484
This project supports internationalization. Currently, only English language is supported. Pull requests to support additional languages are encouraged.
8585

86-
Note to developers: Textual labels are defined in `src/i18n/messages.json`. Ensure that all labels are defined here and that components use i18n, not textual labels directly.
86+
Note to developers: Textual labels are defined in `src/i18n/locales/{lang}.json`. Ensure that all labels are defined here and that components use i18n, not textual labels directly.
8787

8888
Copyright & License
8989
-------------------

src/i18n/locales/en.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,15 @@
296296
"service_updated": "Service updated",
297297
"object_identifier": "Object Identifier",
298298
"object_identifier_desc": "A unique identifier (UUID) that Dependency-Track automatically assigns to every object",
299-
"dependency_graph": "Dependency Graph"
299+
"dependency_graph": "Dependency Graph",
300+
"component_application": "Application",
301+
"component_framework": "Framework",
302+
"component_library": "Library",
303+
"component_container": "Container",
304+
"component_os": "Operation system",
305+
"component_device": "Device",
306+
"component_firmware": "Firmware",
307+
"component_file": "File"
300308
},
301309
"admin": {
302310
"configuration": "Configuration",

src/views/portfolio/projects/ProjectCreateProjectModal.vue

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
lazy="true" required="false" feedback="false" autofocus="false"
1313
:label="$t('message.version')" :tooltip="this.$t('message.component_version_desc')"/>
1414
<b-input-group-form-select id="v-classifier-input" required="true"
15-
v-model="project.classifier" :options="availableClassifiers"
15+
v-model="project.classifier" :options="sortAvailableClassifiers"
1616
:label="$t('message.classifier')" :tooltip="$t('message.component_classifier_desc')" />
1717
<b-form-group
1818
id="project-description-form-group"
@@ -100,14 +100,14 @@
100100
readOnlyProjectName: '',
101101
readOnlyProjectVersion: '',
102102
availableClassifiers: [
103-
{ value: 'APPLICATION', text: 'Application' },
104-
{ value: 'FRAMEWORK', text: 'Framework' },
105-
{ value: 'LIBRARY', text: 'Library' },
106-
{ value: 'CONTAINER', text: 'Container' },
107-
{ value: 'OPERATING_SYSTEM', text: 'Operating System' },
108-
{ value: 'DEVICE', text: 'Device' },
109-
{ value: 'FIRMWARE', text: 'Firmware' },
110-
{ value: 'FILE', text: 'File' }
103+
{ value: 'APPLICATION', text: this.$i18n.t('message.component_application') },
104+
{ value: 'FRAMEWORK', text: this.$i18n.t('message.component_framework') },
105+
{ value: 'LIBRARY', text: this.$i18n.t('message.component_library') },
106+
{ value: 'CONTAINER', text: this.$i18n.t('message.component_container') },
107+
{ value: 'OPERATING_SYSTEM', text: this.$i18n.t('message.component_os') },
108+
{ value: 'DEVICE', text: this.$i18n.t('message.component_device') },
109+
{ value: 'FIRMWARE', text: this.$i18n.t('message.component_firmware') },
110+
{ value: 'FILE', text: this.$i18n.t('message.component_file') }
111111
],
112112
selectableLicenses: [],
113113
selectedLicense: '',
@@ -131,6 +131,14 @@
131131
beforeMount() {
132132
this.retrieveLicenses();
133133
},
134+
computed: {
135+
sortAvailableClassifiers: function() {
136+
this.availableClassifiers.sort(function(a, b) {
137+
return a.text.localeCompare(b.text);
138+
});
139+
return this.availableClassifiers;
140+
}
141+
},
134142
methods: {
135143
syncReadOnlyNameField: function(value) {
136144
this.readOnlyProjectName = value;

0 commit comments

Comments
 (0)