Skip to content

Commit cba049c

Browse files
committed
chore: move hard coded text to i18n file
1 parent 35919a0 commit cba049c

4 files changed

Lines changed: 44 additions & 12 deletions

File tree

app/components/Package/Versions.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,10 @@ function majorGroupContainsCurrent(group: (typeof otherMajorGroups.value)[0]): b
534534
:to="versionsPageRoute"
535535
variant="button-secondary"
536536
class="text-fg-subtle hover:text-fg transition-colors min-w-6 min-h-6 p-1 rounded"
537-
title="View all versions"
537+
:title="$t('package.versions.view_all_versions')"
538538
classicon="i-lucide:history"
539539
>
540-
<span class="sr-only">View all versions</span>
540+
<span class="sr-only">{{ $t('package.versions.view_all_versions') }}</span>
541541
</LinkBase>
542542
<ButtonBase
543543
variant="secondary"

app/pages/package/[[org]]/[name]/versions.vue

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,13 +204,13 @@ const selectedChangelogContent = computed(() => {
204204
>{{ orgName ? packageName.replace(`@${orgName}/`, '') : packageName }}
205205
</NuxtLink>
206206
<span class="text-fg-subtle shrink-0">/</span>
207-
<h1 class="text-sm text-fg-muted shrink-0">Version History</h1>
207+
<h1 class="text-sm text-fg-muted shrink-0">{{ $t('package.versions.page_title') }}</h1>
208208
</div>
209209
<InputBase
210210
v-model="versionFilter"
211211
type="text"
212-
placeholder="Filter versions"
213-
aria-label="Filter versions"
212+
:placeholder="$t('package.versions.version_filter_placeholder')"
213+
:aria-label="$t('package.versions.version_filter_label')"
214214
size="small"
215215
class="w-36 sm:w-44"
216216
/>
@@ -222,7 +222,7 @@ const selectedChangelogContent = computed(() => {
222222
<!-- ── Current Tags ───────────────────────────────────────────────────── -->
223223
<section class="space-y-3">
224224
<h2 class="text-xs text-fg-subtle uppercase tracking-wider px-4 sm:px-6 ps-1">
225-
Current Tags
225+
{{ $t('package.versions.current_tags') }}
226226
</h2>
227227

228228
<!-- Latest — featured card -->
@@ -323,7 +323,7 @@ const selectedChangelogContent = computed(() => {
323323
<!-- ── Version History ───────────────────────────────────────────────── -->
324324
<section v-if="versionGroups.length > 0">
325325
<h2 class="text-xs text-fg-subtle uppercase tracking-wider mb-3 px-4 sm:px-6 ps-1">
326-
Version History
326+
{{ $t('package.versions.page_title') }}
327327
<span class="ms-1 normal-case font-normal tracking-normal">
328328
({{ versionStrings.length }})
329329
</span>
@@ -336,7 +336,7 @@ const selectedChangelogContent = computed(() => {
336336
role="status"
337337
aria-live="polite"
338338
>
339-
No versions match {{ versionFilter }}
339+
{{ $t('package.versions.no_match_filter', { filter: versionFilter }) }}
340340
</div>
341341

342342
<!-- List + changelog side panel -->
@@ -356,7 +356,11 @@ const selectedChangelogContent = computed(() => {
356356
class="flex items-center gap-3 px-4 py-2.5 w-full text-start hover:bg-bg-subtle transition-colors"
357357
:class="index < flatItems.length - 1 ? 'border-b border-border' : ''"
358358
:aria-expanded="expandedGroups.has(item.groupKey)"
359-
:aria-label="`${expandedGroups.has(item.groupKey) ? 'Collapse' : 'Expand'} ${item.label}`"
359+
:aria-label="
360+
expandedGroups.has(item.groupKey)
361+
? $t('package.versions.collapse', { tag: item.label })
362+
: $t('package.versions.expand', { tag: item.label })
363+
"
360364
@click="toggleGroup(item.groupKey)"
361365
>
362366
<span
@@ -513,7 +517,7 @@ const selectedChangelogContent = computed(() => {
513517
type="button"
514518
class="flex items-center gap-3 px-4 py-2.5 w-full text-start border-b border-border last:border-b-0"
515519
:aria-expanded="false"
516-
:aria-label="`Expand ${item.label}`"
520+
:aria-label="$t('package.versions.expand', { tag: item.label })"
517521
>
518522
<span class="w-4 h-4 flex items-center justify-center text-fg-subtle shrink-0">
519523
<span class="i-lucide:chevron-right w-3 h-3 rtl-flip" aria-hidden="true" />
@@ -561,7 +565,7 @@ const selectedChangelogContent = computed(() => {
561565
<button
562566
type="button"
563567
class="text-fg-subtle hover:text-fg transition-colors rounded focus-visible:outline-accent/70 shrink-0 ms-2"
564-
aria-label="Close changelog"
568+
:aria-label="$t('package.versions.close_changelog')"
565569
@click="selectedChangelogVersion = null"
566570
>
567571
<span class="i-lucide:x w-3.5 h-3.5" aria-hidden="true" />

i18n/locales/en.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@
378378
"all_covered": "All versions are covered by tags above",
379379
"deprecated_title": "{version} (deprecated)",
380380
"view_all": "View {count} version | View all {count} versions",
381+
"view_all_versions": "View all versions",
381382
"distribution_title": "Semver Group",
382383
"distribution_modal_title": "Versions",
383384
"distribution_range_date_same_year": "from {from} to {to}, {endYear}",
@@ -402,7 +403,13 @@
402403
"copy_alt": {
403404
"per_version_analysis": "{version} version was downloaded {downloads} times",
404405
"general_description": "Bar chart showing per-version downloads for {versions_count} {semver_grouping_mode} versions of the {package_name} package, {date_range_label} from the {first_version} version to the {last_version} version. The most downloaded version is {max_downloaded_version} with {max_version_downloads} downloads. {per_version_analysis}. {watermark}."
405-
}
406+
},
407+
"page_title": "Version History",
408+
"current_tags": "Current Tags",
409+
"version_filter_placeholder": "Filter versions…",
410+
"version_filter_label": "Filter versions",
411+
"no_match_filter": "No versions match {filter}",
412+
"close_changelog": "Close changelog"
406413
},
407414
"dependencies": {
408415
"title": "Dependency ({count}) | Dependencies ({count})",

i18n/schema.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,9 @@
11381138
"view_all": {
11391139
"type": "string"
11401140
},
1141+
"view_all_versions": {
1142+
"type": "string"
1143+
},
11411144
"distribution_title": {
11421145
"type": "string"
11431146
},
@@ -1212,6 +1215,24 @@
12121215
}
12131216
},
12141217
"additionalProperties": false
1218+
},
1219+
"page_title": {
1220+
"type": "string"
1221+
},
1222+
"current_tags": {
1223+
"type": "string"
1224+
},
1225+
"version_filter_placeholder": {
1226+
"type": "string"
1227+
},
1228+
"version_filter_label": {
1229+
"type": "string"
1230+
},
1231+
"no_match_filter": {
1232+
"type": "string"
1233+
},
1234+
"close_changelog": {
1235+
"type": "string"
12151236
}
12161237
},
12171238
"additionalProperties": false

0 commit comments

Comments
 (0)