@@ -8,6 +8,8 @@ const props = defineProps<{
88
99const open = defineModel <boolean >(' open' , { default: false })
1010
11+ const { t } = useI18n ()
12+
1113const {
1214 isConnected,
1315 state,
@@ -32,7 +34,7 @@ async function checkAvailability() {
3234 try {
3335 checkResult .value = await checkPackageName (props .packageName )
3436 } catch (err ) {
35- publishError .value = err instanceof Error ? err .message : ' Failed to check name availability '
37+ publishError .value = err instanceof Error ? err .message : t ( ' claim.modal.failed_to_check ' )
3638 } finally {
3739 isChecking .value = false
3840 }
@@ -82,7 +84,7 @@ async function handleClaim() {
8284 connectorModalOpen .value = true
8385 }
8486 } catch (err ) {
85- publishError .value = err instanceof Error ? err .message : ' Failed to claim package '
87+ publishError .value = err instanceof Error ? err .message : t ( ' claim.modal.failed_to_claim ' )
8688 } finally {
8789 isPublishing .value = false
8890 }
@@ -141,7 +143,7 @@ const connectorModalOpen = shallowRef(false)
141143 <button
142144 type =" button"
143145 class =" absolute inset-0 bg-black/60 cursor-default"
144- aria-label =" Close modal"
146+ : aria-label =" $t('claim. modal.close_modal') "
145147 @click =" open = false"
146148 />
147149
@@ -155,12 +157,12 @@ const connectorModalOpen = shallowRef(false)
155157 <div class =" p-6" >
156158 <div class =" flex items-center justify-between mb-6" >
157159 <h2 id =" claim-modal-title" class =" font-mono text-lg font-medium" >
158- Claim Package Name
160+ {{ $t('claim.modal.title') }}
159161 </h2 >
160162 <button
161163 type =" button"
162164 class =" text-fg-subtle hover:text-fg transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50 rounded"
163- aria-label =" Close "
165+ : aria-label =" $t('claim.modal.close') "
164166 @click =" open = false"
165167 >
166168 <span class =" i-carbon-close block w-5 h-5" aria-hidden =" true" />
@@ -169,7 +171,7 @@ const connectorModalOpen = shallowRef(false)
169171
170172 <!-- Loading state -->
171173 <div v-if =" isChecking" class =" py-8 text-center" >
172- <LoadingSpinner text =" Checking availability… " />
174+ <LoadingSpinner : text =" t('claim.modal.checking') " />
173175 </div >
174176
175177 <!-- Success state -->
@@ -179,16 +181,15 @@ const connectorModalOpen = shallowRef(false)
179181 >
180182 <span class =" i-carbon-checkmark-filled text-green-500 w-6 h-6" aria-hidden =" true" />
181183 <div >
182- <p class =" font-mono text-sm text-fg" >Package claimed! </p >
184+ <p class =" font-mono text-sm text-fg" >{{ $t('claim.modal.success') }} </p >
183185 <p class =" text-xs text-fg-muted" >
184- {{ packageName }}@0.0.0 has been published to npm.
186+ {{ $t('claim.modal.success_detail', { name: packageName }) }}
185187 </p >
186188 </div >
187189 </div >
188190
189191 <p class =" text-sm text-fg-muted" >
190- You can now publish new versions to this package using
191- <code class =" font-mono bg-bg-subtle px-1 rounded" >npm publish</code >.
192+ {{ $t('claim.modal.success_hint') }}
192193 </p >
193194
194195 <div class =" flex gap-3" >
@@ -197,14 +198,14 @@ const connectorModalOpen = shallowRef(false)
197198 class =" flex-1 px-4 py-2 font-mono text-sm text-center text-bg bg-fg rounded-md transition-colors duration-200 hover:bg-fg/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
198199 @click =" open = false"
199200 >
200- View Package
201+ {{ $t('claim.modal.view_package') }}
201202 </NuxtLink >
202203 <button
203204 type =" button"
204205 class =" flex-1 px-4 py-2 font-mono text-sm text-fg-muted bg-bg-subtle border border-border rounded-md transition-colors duration-200 hover:text-fg hover:border-border-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
205206 @click =" open = false"
206207 >
207- Close
208+ {{ $t('claim.modal.close') }}
208209 </button >
209210 </div >
210211 </div >
@@ -222,7 +223,7 @@ const connectorModalOpen = shallowRef(false)
222223 class =" p-3 text-sm text-red-400 bg-red-500/10 border border-red-500/20 rounded-md"
223224 role =" alert"
224225 >
225- <p class =" font-medium mb-1" >Invalid package name: </p >
226+ <p class =" font-medium mb-1" >{{ $t('claim.modal.invalid_name') }} </p >
226227 <ul class =" list-disc list-inside space-y-1" >
227228 <li v-for =" err in checkResult.validationErrors" :key =" err" >{{ err }}</li >
228229 </ul >
@@ -234,7 +235,7 @@ const connectorModalOpen = shallowRef(false)
234235 class =" p-3 text-sm text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded-md"
235236 role =" alert"
236237 >
237- <p class =" font-medium mb-1" >Warnings: </p >
238+ <p class =" font-medium mb-1" >{{ $t('common.warnings') }} </p >
238239 <ul class =" list-disc list-inside space-y-1" >
239240 <li v-for =" warn in checkResult.validationWarnings" :key =" warn" >{{ warn }}</li >
240241 </ul >
@@ -250,15 +251,15 @@ const connectorModalOpen = shallowRef(false)
250251 class =" i-carbon-checkmark-filled text-green-500 w-5 h-5"
251252 aria-hidden =" true"
252253 />
253- <p class =" font-mono text-sm text-fg" >This name is available! </p >
254+ <p class =" font-mono text-sm text-fg" >{{ $t('claim.modal. available') }} </p >
254255 </div >
255256
256257 <div
257258 v-else
258259 class =" flex items-center gap-3 p-4 bg-red-500/10 border border-red-500/20 rounded-lg"
259260 >
260261 <span class =" i-carbon-close-filled text-red-500 w-5 h-5" aria-hidden =" true" />
261- <p class =" font-mono text-sm text-fg" >This name is already taken. </p >
262+ <p class =" font-mono text-sm text-fg" >{{ $t('claim.modal.taken') }} </p >
262263 </div >
263264 </div >
264265
@@ -277,9 +278,9 @@ const connectorModalOpen = shallowRef(false)
277278 class =" text-sm font-medium mb-3"
278279 >
279280 <span v-if =" hasDangerousSimilarPackages" >
280- Similar packages exist - npm may reject this name:
281+ {{ $t('claim.modal.similar_warning') }}
281282 </span >
282- <span v-else > Related packages: </span >
283+ <span v-else >{{ $t('claim.modal.related') }} </span >
283284 </p >
284285 <ul class =" space-y-2" >
285286 <li
@@ -331,13 +332,14 @@ const connectorModalOpen = shallowRef(false)
331332 v-if =" !isScoped"
332333 class =" p-3 text-sm text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded-md"
333334 >
334- <p class =" font-medium mb-1" >Consider using a scoped package instead </p >
335+ <p class =" font-medium mb-1" >{{ $t('claim.modal.scope_warning_title') }} </p >
335336 <p class =" text-xs text-yellow-400/80" >
336- Unscoped package names are a shared resource. Only claim a name if you intend to
337- publish and maintain a package. For personal or organizational projects, use a
338- scoped name like
339- <code class =" font-mono" >@{{ npmUser || 'username' }}/{{ packageName }}</code
340- >.
337+ {{
338+ $t('claim.modal.scope_warning_text', {
339+ username: npmUser || 'username',
340+ name: packageName,
341+ })
342+ }}
341343 </p >
342344 </div >
343345
@@ -346,29 +348,29 @@ const connectorModalOpen = shallowRef(false)
346348 <div
347349 class =" p-3 text-sm text-yellow-400 bg-yellow-500/10 border border-yellow-500/20 rounded-md"
348350 >
349- <p >Connect to the local connector to claim this package name. </p >
351+ <p >{{ $t(' claim.modal.connect_required') }} </p >
350352 </div >
351353 <button
352354 type =" button"
353355 class =" w-full px-4 py-2 font-mono text-sm text-bg bg-fg rounded-md transition-colors duration-200 hover:bg-fg/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
354356 @click =" connectorModalOpen = true"
355357 >
356- Connect to Connector
358+ {{ $t('claim.modal.connect_button') }}
357359 </button >
358360 </div >
359361
360362 <!-- Claim button -->
361363 <div v-else class =" space-y-3" >
362364 <p class =" text-sm text-fg-muted" >
363- This will publish a minimal placeholder package.
365+ {{ $t('claim.modal.publish_hint') }}
364366 </p >
365367
366368 <!-- Expandable package.json preview -->
367369 <details class =" border border-border rounded-md overflow-hidden" >
368370 <summary
369371 class =" px-3 py-2 text-sm text-fg-muted bg-bg-subtle cursor-pointer hover:text-fg transition-colors select-none"
370372 >
371- Preview package.json
373+ {{ $t('claim.modal.preview_json') }}
372374 </summary >
373375 <pre class =" p-3 text-xs font-mono text-fg-muted bg-[#0d0d0d] overflow-x-auto" >{{
374376 JSON.stringify(previewPackageJson, null, 2)
@@ -381,7 +383,9 @@ const connectorModalOpen = shallowRef(false)
381383 class =" w-full px-4 py-2 font-mono text-sm text-bg bg-fg rounded-md transition-colors duration-200 hover:bg-fg/90 disabled:opacity-50 disabled:cursor-not-allowed focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
382384 @click =" handleClaim"
383385 >
384- {{ isPublishing ? 'Publishing…' : 'Claim Package Name' }}
386+ {{
387+ isPublishing ? $t('claim.modal.publishing') : $t('claim.modal.claim_button')
388+ }}
385389 </button >
386390 </div >
387391 </div >
@@ -393,7 +397,7 @@ const connectorModalOpen = shallowRef(false)
393397 class =" w-full px-4 py-2 font-mono text-sm text-fg-muted bg-bg-subtle border border-border rounded-md transition-colors duration-200 hover:text-fg hover:border-border-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
394398 @click =" open = false"
395399 >
396- Close
400+ {{ $t('claim.modal.close') }}
397401 </button >
398402 </div >
399403
@@ -410,7 +414,7 @@ const connectorModalOpen = shallowRef(false)
410414 class =" w-full px-4 py-2 font-mono text-sm text-fg-muted bg-bg-subtle border border-border rounded-md transition-colors duration-200 hover:text-fg hover:border-border-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50"
411415 @click =" checkAvailability"
412416 >
413- Retry
417+ {{ $t('claim.modal.retry') }}
414418 </button >
415419 </div >
416420 </div >
0 commit comments