3030 </Message >
3131 </template >
3232 <div class =" mb-3 flex gap-2" >
33- <SelectButton v-model =" filterType" :options =" filterTypes" />
33+ <SelectButton
34+ v-model =" filterType"
35+ :options =" filterTypes"
36+ option-label =" label"
37+ option-value =" value"
38+ />
3439 </div >
3540 <DataTable
3641 v-model:selection =" selectedExtensions"
4752 {{ slotProps.data.name }}
4853 <Tag
4954 v-if =" extensionStore.isCoreExtension(slotProps.data.name)"
50- value =" Core "
55+ : value =" $t('g.core') "
5156 />
52- <Tag v-else value =" Custom " severity =" info" />
57+ <Tag v-else : value =" $t('g.custom') " severity =" info" />
5358 </template >
5459 </Column >
5560 <Column
@@ -90,15 +95,26 @@ import SelectButton from 'primevue/selectbutton'
9095import Tag from ' primevue/tag'
9196import ToggleSwitch from ' primevue/toggleswitch'
9297import { computed , onMounted , ref } from ' vue'
98+ import { useI18n } from ' vue-i18n'
9399
94100import SearchBox from ' @/components/common/SearchBox.vue'
95101import PanelTemplate from ' @/components/dialog/content/setting/PanelTemplate.vue'
96102import { useSettingStore } from ' @/platform/settings/settingStore'
97103import { useExtensionStore } from ' @/stores/extensionStore'
104+ import type { ComfyExtension } from ' @/types/comfy'
105+
106+ const { t } = useI18n ()
98107
99- const filterTypes = [' All' , ' Core' , ' Custom' ]
100- const filterType = ref (' All' )
101- const selectedExtensions = ref <Array <any >>([])
108+ const filterTypeKeys = [' all' , ' core' , ' custom' ] as const
109+ type FilterTypeKey = (typeof filterTypeKeys )[number ]
110+ const filterTypes = computed (() =>
111+ filterTypeKeys .map ((key ) => ({
112+ label: t (` g.${key } ` ),
113+ value: key
114+ }))
115+ )
116+ const filterType = ref <FilterTypeKey >(' all' )
117+ const selectedExtensions = ref <ComfyExtension []>([])
102118
103119const filters = ref ({
104120 global: { value: ' ' , matchMode: FilterMatchMode .CONTAINS }
@@ -112,11 +128,11 @@ const editingEnabledExtensions = ref<Record<string, boolean>>({})
112128const filteredExtensions = computed (() => {
113129 const extensions = extensionStore .extensions
114130 switch (filterType .value ) {
115- case ' Core ' :
131+ case ' core ' :
116132 return extensions .filter ((ext ) =>
117133 extensionStore .isCoreExtension (ext .name )
118134 )
119- case ' Custom ' :
135+ case ' custom ' :
120136 return extensions .filter (
121137 (ext ) => ! extensionStore .isCoreExtension (ext .name )
122138 )
@@ -190,9 +206,9 @@ const applyChanges = () => {
190206}
191207
192208const menu = ref <InstanceType <typeof ContextMenu >>()
193- const contextMenuItems = [
209+ const contextMenuItems = computed (() => [
194210 {
195- label: ' Enable Selected ' ,
211+ label: t ( ' g.enableSelected ' ) ,
196212 icon: ' pi pi-check' ,
197213 command : async () => {
198214 selectedExtensions .value .forEach ((ext ) => {
@@ -204,7 +220,7 @@ const contextMenuItems = [
204220 }
205221 },
206222 {
207- label: ' Disable Selected ' ,
223+ label: t ( ' g.disableSelected ' ) ,
208224 icon: ' pi pi-times' ,
209225 command : async () => {
210226 selectedExtensions .value .forEach ((ext ) => {
@@ -219,20 +235,20 @@ const contextMenuItems = [
219235 separator: true
220236 },
221237 {
222- label: ' Enable All ' ,
238+ label: t ( ' g.enableAll ' ) ,
223239 icon: ' pi pi-check' ,
224240 command: enableAllExtensions
225241 },
226242 {
227- label: ' Disable All ' ,
243+ label: t ( ' g.disableAll ' ) ,
228244 icon: ' pi pi-times' ,
229245 command: disableAllExtensions
230246 },
231247 {
232- label: ' Disable 3rd Party ' ,
248+ label: t ( ' g.disableThirdParty ' ) ,
233249 icon: ' pi pi-times' ,
234250 command: disableThirdPartyExtensions ,
235251 disabled: ! extensionStore .hasThirdPartyExtensions
236252 }
237- ]
253+ ])
238254 </script >
0 commit comments