@uipkge/nuxt 0.1.30 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.mjs +38 -8
- package/dist/module.json +1 -1
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -36,6 +36,25 @@ if (!isInstalled) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
const nuxtConfigPath = path.join(TARGET_DIR, 'nuxt.config.ts')
|
|
39
|
+
|
|
40
|
+
function prompt(question) {
|
|
41
|
+
const readline = require('readline')
|
|
42
|
+
return new Promise(resolve => {
|
|
43
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout })
|
|
44
|
+
rl.question(question, ans => { rl.close(); resolve(ans) })
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function getInput(question, defaultValue) {
|
|
49
|
+
const answer = await prompt(question)
|
|
50
|
+
return answer.trim() || defaultValue
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
console.log('\n⚙️ i18now configuration:')
|
|
54
|
+
|
|
55
|
+
const projectId = await getInput('Enter projectId (or press Enter to skip): ', '')
|
|
56
|
+
const apiKey = await getInput('Enter apiKey (or press Enter to skip): ', '')
|
|
57
|
+
|
|
39
58
|
const nuxtConfigContent = `export default defineNuxtConfig({
|
|
40
59
|
compatibilityDate: '2025-07-15',
|
|
41
60
|
devtools: { enabled: true },
|
|
@@ -44,8 +63,8 @@ const nuxtConfigContent = `export default defineNuxtConfig({
|
|
|
44
63
|
defaultLocale: 'en',
|
|
45
64
|
},
|
|
46
65
|
i18now: {
|
|
47
|
-
projectId:
|
|
48
|
-
apiKey:
|
|
66
|
+
projectId: '${projectId}',
|
|
67
|
+
apiKey: '${apiKey}',
|
|
49
68
|
},
|
|
50
69
|
})
|
|
51
70
|
`
|
|
@@ -56,19 +75,30 @@ if (!fs.existsSync(pagesDir)) {
|
|
|
56
75
|
fs.mkdirSync(pagesDir, { recursive: true })
|
|
57
76
|
}
|
|
58
77
|
|
|
59
|
-
const
|
|
60
|
-
if (!fs.existsSync(
|
|
61
|
-
|
|
78
|
+
const testPagePath = path.join(TARGET_DIR, 'app/pages/i18now-test.vue')
|
|
79
|
+
if (!fs.existsSync(testPagePath)) {
|
|
80
|
+
console.log('📄 Creating test page at /i18now-test...')
|
|
81
|
+
fs.writeFileSync(testPagePath, `<script setup>
|
|
62
82
|
const { t, locale } = useI18now()
|
|
63
83
|
</script>
|
|
64
84
|
|
|
65
85
|
<template>
|
|
66
|
-
<div>
|
|
67
|
-
<h1>
|
|
68
|
-
|
|
86
|
+
<div style="padding: 20px; font-family: sans-serif; max-width: 600px;">
|
|
87
|
+
<h1>i18now Test Page</h1>
|
|
88
|
+
|
|
89
|
+
<h2>Translation Keys (try adding new ones):</h2>
|
|
90
|
+
<p>{{ t('welcome_message', 'Welcome to i18now!') }}</p>
|
|
91
|
+
<p>{{ t('description', 'This is a test page for translations.') }}</p>
|
|
92
|
+
<p>{{ t('feature_sync', 'Key sync is enabled in development mode.') }}</p>
|
|
93
|
+
|
|
94
|
+
<h2>Language Switcher:</h2>
|
|
95
|
+
<select v-model="locale" style="padding: 8px; margin: 10px 0;">
|
|
69
96
|
<option value="en">English</option>
|
|
70
97
|
<option value="es">Español</option>
|
|
71
98
|
</select>
|
|
99
|
+
|
|
100
|
+
<p><small>Current locale: {{ locale }}</small></p>
|
|
101
|
+
<p><small>Add new t() calls above to test key sync!</small></p>
|
|
72
102
|
</div>
|
|
73
103
|
</template>
|
|
74
104
|
`)
|
package/dist/module.json
CHANGED