Skip to content

Commit 3840e71

Browse files
committed
fix(i18n): restore wrongly removed keys
1 parent 57750bd commit 3840e71

51 files changed

Lines changed: 1846 additions & 201 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app/components/ColumnPicker.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ onKeyDown(
4141
const toggleableColumns = computed(() => props.columns.filter(col => col.id !== 'name'))
4242
4343
// Map column IDs to i18n keys
44-
const columnLabelKey = computed(() => ({
44+
const columnLabels = computed(() => ({
4545
name: $t('filters.columns.name'),
4646
version: $t('filters.columns.version'),
4747
description: $t('filters.columns.description'),
@@ -57,7 +57,7 @@ const columnLabelKey = computed(() => ({
5757
}))
5858
5959
function getColumnLabel(id: ColumnId): string {
60-
const key = columnLabelKey.value[id]
60+
const key = columnLabels.value[id]
6161
return key ?? id
6262
}
6363

app/components/Filter/Panel.vue

Lines changed: 63 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ const emit = defineEmits<{
2727
'toggleKeyword': [keyword: string]
2828
}>()
2929
30+
const { t } = useI18n()
31+
3032
const isExpanded = shallowRef(false)
3133
const showAllKeywords = shallowRef(false)
3234
@@ -55,62 +57,77 @@ const hasMoreKeywords = computed(() => {
5557
})
5658
5759
// i18n mappings for filter options
58-
const scopeLabelKeys = {
59-
name: 'filters.scope_name',
60-
description: 'filters.scope_description',
61-
keywords: 'filters.scope_keywords',
62-
all: 'filters.scope_all',
63-
} as const
64-
65-
const scopeDescriptionKeys = {
66-
name: 'filters.scope_name_description',
67-
description: 'filters.scope_description_description',
68-
keywords: 'filters.scope_keywords_description',
69-
all: 'filters.scope_all_description',
70-
} as const
71-
72-
const downloadRangeLabelKeys = {
73-
'any': 'filters.download_range.any',
74-
'lt100': 'filters.download_range.lt100',
75-
'100-1k': 'filters.download_range.100_1k',
76-
'1k-10k': 'filters.download_range.1k_10k',
77-
'10k-100k': 'filters.download_range.10k_100k',
78-
'gt100k': 'filters.download_range.gt100k',
79-
} as const
80-
81-
const updatedWithinLabelKeys = {
82-
any: 'filters.updated.any',
83-
week: 'filters.updated.week',
84-
month: 'filters.updated.month',
85-
quarter: 'filters.updated.quarter',
86-
year: 'filters.updated.year',
87-
} as const
88-
89-
const securityLabelKeys = {
90-
all: 'filters.security_options.all',
91-
secure: 'filters.security_options.secure',
92-
warnings: 'filters.security_options.insecure',
93-
} as const
60+
const scopeLabelKeys = computed(
61+
() =>
62+
({
63+
name: t('filters.scope_name'),
64+
description: t('filters.scope_description'),
65+
keywords: t('filters.scope_keywords'),
66+
all: t('filters.scope_all'),
67+
}) as const,
68+
)
69+
70+
const scopeDescriptionKeys = computed(
71+
() =>
72+
({
73+
name: t('filters.scope_name_description'),
74+
description: t('filters.scope_description_description'),
75+
keywords: t('filters.scope_keywords_description'),
76+
all: t('filters.scope_all_description'),
77+
}) as const,
78+
)
79+
80+
const downloadRangeLabelKeys = computed(
81+
() =>
82+
({
83+
'any': t('filters.download_range.any'),
84+
'lt100': t('filters.download_range.lt100'),
85+
'100-1k': t('filters.download_range.100_1k'),
86+
'1k-10k': t('filters.download_range.1k_10k'),
87+
'10k-100k': t('filters.download_range.10k_100k'),
88+
'gt100k': t('filters.download_range.gt100k'),
89+
}) as const,
90+
)
91+
92+
const updatedWithinLabelKeys = computed(
93+
() =>
94+
({
95+
any: t('filters.updated.any'),
96+
week: t('filters.updated.week'),
97+
month: t('filters.updated.month'),
98+
quarter: t('filters.updated.quarter'),
99+
year: t('filters.updated.year'),
100+
}) as const,
101+
)
102+
103+
const securityLabelKeys = computed(
104+
() =>
105+
({
106+
all: t('filters.security_options.all'),
107+
secure: t('filters.security_options.secure'),
108+
warnings: t('filters.security_options.insecure'),
109+
}) as const,
110+
)
94111
95112
// Type-safe accessor functions
96113
function getScopeLabelKey(value: SearchScope): string {
97-
return scopeLabelKeys[value]
114+
return scopeLabelKeys.value[value]
98115
}
99116
100117
function getScopeDescriptionKey(value: SearchScope): string {
101-
return scopeDescriptionKeys[value]
118+
return scopeDescriptionKeys.value[value]
102119
}
103120
104121
function getDownloadRangeLabelKey(value: DownloadRange): string {
105-
return downloadRangeLabelKeys[value]
122+
return downloadRangeLabelKeys.value[value]
106123
}
107124
108125
function getUpdatedWithinLabelKey(value: UpdatedWithin): string {
109-
return updatedWithinLabelKeys[value]
126+
return updatedWithinLabelKeys.value[value]
110127
}
111128
112129
function getSecurityLabelKey(value: SecurityFilter): string {
113-
return securityLabelKeys[value]
130+
return securityLabelKeys.value[value]
114131
}
115132
116133
function handleTextInput(event: Event) {
@@ -215,10 +232,10 @@ const hasActiveFilters = computed(() => !!filterSummary.value)
215232
: 'text-fg-muted hover:text-fg'
216233
"
217234
:aria-pressed="filters.searchScope === scope"
218-
:title="$t(getScopeDescriptionKey(scope))"
235+
:title="getScopeDescriptionKey(scope)"
219236
@click="emit('update:searchScope', scope)"
220237
>
221-
{{ $t(getScopeLabelKey(scope)) }}
238+
{{ getScopeLabelKey(scope) }}
222239
</button>
223240
</div>
224241
</div>
@@ -251,7 +268,7 @@ const hasActiveFilters = computed(() => !!filterSummary.value)
251268
@update:modelValue="emit('update:downloadRange', $event as DownloadRange)"
252269
name="range"
253270
>
254-
{{ $t(getDownloadRangeLabelKey(range.value)) }}
271+
{{ getDownloadRangeLabelKey(range.value) }}
255272
</TagRadioButton>
256273
</div>
257274
</fieldset>
@@ -274,7 +291,7 @@ const hasActiveFilters = computed(() => !!filterSummary.value)
274291
name="updatedWithin"
275292
@update:modelValue="emit('update:updatedWithin', $event as UpdatedWithin)"
276293
>
277-
{{ $t(getUpdatedWithinLabelKey(option.value)) }}
294+
{{ getUpdatedWithinLabelKey(option.value) }}
278295
</TagRadioButton>
279296
</div>
280297
</fieldset>
@@ -296,7 +313,7 @@ const hasActiveFilters = computed(() => !!filterSummary.value)
296313
:value="security"
297314
name="security"
298315
>
299-
{{ $t(getSecurityLabelKey(security)) }}
316+
{{ getSecurityLabelKey(security) }}
300317
</TagRadioButton>
301318
</div>
302319
</fieldset>

app/components/Package/ListToolbar.vue

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ const props = defineProps<{
3232
searchContext?: boolean
3333
}>()
3434
35+
const { t } = useI18n()
36+
3537
const sortOption = defineModel<SortOption>('sortOption', { required: true })
3638
const viewMode = defineModel<ViewMode>('viewMode', { required: true })
3739
const paginationMode = defineModel<PaginationMode>('paginationMode', { required: true })
@@ -85,22 +87,22 @@ function handleToggleDirection() {
8587
}
8688
8789
// Map sort key to i18n key
88-
const sortKeyLabelKeys: Record<SortKey, string> = {
89-
'relevance': 'filters.sort.relevance',
90-
'downloads-week': 'filters.sort.downloads_week',
91-
'downloads-day': 'filters.sort.downloads_day',
92-
'downloads-month': 'filters.sort.downloads_month',
93-
'downloads-year': 'filters.sort.downloads_year',
94-
'updated': 'filters.sort.published',
95-
'name': 'filters.sort.name',
90+
const sortKeyLabelKeys = computed<Record<SortKey, string>>(() => ({
91+
'relevance': t('filters.sort.relevance'),
92+
'downloads-week': t('filters.sort.downloads_week'),
93+
'downloads-day': t('filters.sort.downloads_day'),
94+
'downloads-month': t('filters.sort.downloads_month'),
95+
'downloads-year': t('filters.sort.downloads_year'),
96+
'updated': t('filters.sort.published'),
97+
'name': t('filters.sort.name'),
9698
'quality': 'filters.sort.quality',
97-
'popularity': 'filters.sort.popularity',
98-
'maintenance': 'filters.sort.maintenance',
99-
'score': 'filters.sort.score',
100-
}
99+
'popularity': t('filters.sort.popularity'),
100+
'maintenance': t('filters.sort.maintenance'),
101+
'score': t('filters.sort.score'),
102+
}))
101103
102104
function getSortKeyLabelKey(key: SortKey): string {
103-
return sortKeyLabelKeys[key]
105+
return sortKeyLabelKeys.value[key]
104106
}
105107
</script>
106108

@@ -169,7 +171,7 @@ function getSortKeyLabelKey(key: SortKey): string {
169171
:value="keyConfig.key"
170172
:disabled="keyConfig.disabled"
171173
>
172-
{{ $t(getSortKeyLabelKey(keyConfig.key)) }}
174+
{{ getSortKeyLabelKey(keyConfig.key) }}
173175
</option>
174176
</select>
175177
<div

app/components/Package/Table.vue

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ const props = defineProps<{
1616
isLoading?: boolean
1717
}>()
1818
19+
const { t } = useI18n()
20+
1921
const sortOption = defineModel<SortOption>('sortOption')
2022
2123
const emit = defineEmits<{
@@ -87,23 +89,23 @@ function toggleSort(id: string) {
8789
}
8890
8991
// Map column IDs to i18n keys
90-
const columnLabelKeys: Record<ColumnId, string> = {
91-
name: 'filters.columns.name',
92-
version: 'filters.columns.version',
93-
description: 'filters.columns.description',
94-
downloads: 'filters.columns.downloads',
95-
updated: 'filters.columns.published',
96-
maintainers: 'filters.columns.maintainers',
97-
keywords: 'filters.columns.keywords',
98-
qualityScore: 'filters.columns.quality_score',
99-
popularityScore: 'filters.columns.popularity_score',
100-
maintenanceScore: 'filters.columns.maintenance_score',
101-
combinedScore: 'filters.columns.combined_score',
102-
security: 'filters.columns.security',
103-
}
92+
const columnLabels = computed(() => ({
93+
name: t('filters.columns.name'),
94+
version: t('filters.columns.version'),
95+
description: t('filters.columns.description'),
96+
downloads: t('filters.columns.downloads'),
97+
updated: t('filters.columns.published'),
98+
maintainers: t('filters.columns.maintainers'),
99+
keywords: t('filters.columns.keywords'),
100+
qualityScore: t('filters.columns.quality_score'),
101+
popularityScore: t('filters.columns.popularity_score'),
102+
maintenanceScore: t('filters.columns.maintenance_score'),
103+
combinedScore: t('filters.columns.combined_score'),
104+
security: t('filters.columns.security'),
105+
}))
104106
105-
function getColumnLabelKey(id: ColumnId): string {
106-
return columnLabelKeys[id]
107+
function getColumnLabel(id: ColumnId): string {
108+
return columnLabels.value[id]
107109
}
108110
</script>
109111

@@ -133,7 +135,7 @@ function getColumnLabelKey(id: ColumnId): string {
133135
@keydown.space.prevent="toggleSort('name')"
134136
>
135137
<span class="inline-flex items-center gap-1">
136-
{{ $t(getColumnLabelKey('name')) }}
138+
{{ getColumnLabel('name') }}
137139
<template v-if="isSortable('name')">
138140
<span
139141
v-if="isColumnSorted('name')"
@@ -151,15 +153,15 @@ function getColumnLabelKey(id: ColumnId): string {
151153
scope="col"
152154
class="py-3 px-3 text-xs text-start text-fg-muted font-mono font-medium uppercase tracking-wider whitespace-nowrap select-none"
153155
>
154-
{{ $t(getColumnLabelKey('version')) }}
156+
{{ getColumnLabel('version') }}
155157
</th>
156158

157159
<th
158160
v-if="isColumnVisible('description')"
159161
scope="col"
160162
class="py-3 px-3 text-xs text-start text-fg-muted font-mono font-medium uppercase tracking-wider whitespace-nowrap select-none"
161163
>
162-
{{ $t(getColumnLabelKey('description')) }}
164+
{{ getColumnLabel('description') }}
163165
</th>
164166

165167
<th
@@ -184,7 +186,7 @@ function getColumnLabelKey(id: ColumnId): string {
184186
@keydown.space.prevent="toggleSort('downloads')"
185187
>
186188
<span class="inline-flex items-center gap-1 justify-end">
187-
{{ $t(getColumnLabelKey('downloads')) }}
189+
{{ getColumnLabel('downloads') }}
188190
<template v-if="isSortable('downloads')">
189191
<span
190192
v-if="isColumnSorted('downloads')"
@@ -218,7 +220,7 @@ function getColumnLabelKey(id: ColumnId): string {
218220
@keydown.space.prevent="toggleSort('updated')"
219221
>
220222
<span class="inline-flex items-center gap-1">
221-
{{ $t(getColumnLabelKey('updated')) }}
223+
{{ getColumnLabel('updated') }}
222224
<template v-if="isSortable('updated')">
223225
<span
224226
v-if="isColumnSorted('updated')"
@@ -236,55 +238,55 @@ function getColumnLabelKey(id: ColumnId): string {
236238
scope="col"
237239
class="py-3 px-3 text-xs text-start text-fg-muted font-mono font-medium uppercase tracking-wider whitespace-nowrap select-none text-end"
238240
>
239-
{{ $t(getColumnLabelKey('maintainers')) }}
241+
{{ getColumnLabel('maintainers') }}
240242
</th>
241243

242244
<th
243245
v-if="isColumnVisible('keywords')"
244246
scope="col"
245247
class="py-3 px-3 text-xs text-start text-fg-muted font-mono font-medium uppercase tracking-wider whitespace-nowrap select-none text-end"
246248
>
247-
{{ $t(getColumnLabelKey('keywords')) }}
249+
{{ getColumnLabel('keywords') }}
248250
</th>
249251

250252
<th
251253
v-if="isColumnVisible('qualityScore')"
252254
scope="col"
253255
class="py-3 px-3 text-xs text-start text-fg-muted font-mono font-medium uppercase tracking-wider whitespace-nowrap select-none text-end"
254256
>
255-
{{ $t(getColumnLabelKey('qualityScore')) }}
257+
{{ getColumnLabel('qualityScore') }}
256258
</th>
257259

258260
<th
259261
v-if="isColumnVisible('popularityScore')"
260262
scope="col"
261263
class="py-3 px-3 text-xs text-start text-fg-muted font-mono font-medium uppercase tracking-wider whitespace-nowrap select-none text-end"
262264
>
263-
{{ $t(getColumnLabelKey('popularityScore')) }}
265+
{{ getColumnLabel('popularityScore') }}
264266
</th>
265267

266268
<th
267269
v-if="isColumnVisible('maintenanceScore')"
268270
scope="col"
269271
class="py-3 px-3 text-xs text-start text-fg-muted font-mono font-medium uppercase tracking-wider whitespace-nowrap select-none text-end"
270272
>
271-
{{ $t(getColumnLabelKey('maintenanceScore')) }}
273+
{{ getColumnLabel('maintenanceScore') }}
272274
</th>
273275

274276
<th
275277
v-if="isColumnVisible('combinedScore')"
276278
scope="col"
277279
class="py-3 px-3 text-xs text-start text-fg-muted font-mono font-medium uppercase tracking-wider whitespace-nowrap select-none text-end"
278280
>
279-
{{ $t(getColumnLabelKey('combinedScore')) }}
281+
{{ getColumnLabel('combinedScore') }}
280282
</th>
281283

282284
<th
283285
v-if="isColumnVisible('security')"
284286
scope="col"
285287
class="py-3 px-3 text-xs text-start text-fg-muted font-mono font-medium uppercase tracking-wider whitespace-nowrap select-none text-end"
286288
>
287-
{{ $t(getColumnLabelKey('security')) }}
289+
{{ getColumnLabel('security') }}
288290
</th>
289291
</tr>
290292
</thead>

0 commit comments

Comments
 (0)