astro-blog-kit 0.2.4 → 0.2.6

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.js CHANGED
@@ -65,10 +65,12 @@ async function main() {
65
65
  { value: "cards", label: "Cards \u2014 image background + text overlay" }
66
66
  ]
67
67
  }),
68
- locale: () => p.text({
68
+ locale: () => p.select({
69
69
  message: "Default locale",
70
- placeholder: "en",
71
- initialValue: "en"
70
+ options: [
71
+ { value: "en", label: "English" },
72
+ { value: "es", label: "Espa\xF1ol" }
73
+ ]
72
74
  }),
73
75
  i18n: () => p.confirm({
74
76
  message: "Enable i18n (multiple languages)?",
@@ -82,6 +84,28 @@ async function main() {
82
84
  }
83
85
  }
84
86
  );
87
+ const translations = {
88
+ en: {
89
+ T_TAGLINE: "Our Blog",
90
+ T_TITLE_LINE1: "Latest",
91
+ T_TITLE_LINE2: "Articles",
92
+ T_DESCRIPTION: "Welcome to our blog.",
93
+ T_BTNCTA: "Read more",
94
+ T_BTN_PREV: "Previous",
95
+ T_BTN_NEXT: "Next"
96
+ },
97
+ es: {
98
+ T_TAGLINE: "Nuestro Blog",
99
+ T_TITLE_LINE1: "\xDAltimos",
100
+ T_TITLE_LINE2: "Art\xEDculos",
101
+ T_DESCRIPTION: "Bienvenido a nuestro blog.",
102
+ T_BTNCTA: "Leer m\xE1s",
103
+ T_BTN_PREV: "Anterior",
104
+ T_BTN_NEXT: "Siguiente"
105
+ }
106
+ };
107
+ const locale = answers.locale;
108
+ const t = translations[locale] ?? translations["en"];
85
109
  const hasLayout = answers.hasLayout;
86
110
  const replacements = {
87
111
  WP_URL: answers.wpUrl,
@@ -99,7 +123,8 @@ async function main() {
99
123
  </head>
100
124
  <body>`,
101
125
  LAYOUT_CLOSE: hasLayout ? `</Layout>` : ` </body>
102
- </html>`
126
+ </html>`,
127
+ ...t
103
128
  };
104
129
  const cwd = process.cwd();
105
130
  const spinner2 = p.spinner();
package/cli.ts CHANGED
@@ -95,10 +95,12 @@ async function main() {
95
95
  }),
96
96
 
97
97
  locale: () =>
98
- p.text({
98
+ p.select({
99
99
  message: "Default locale",
100
- placeholder: "en",
101
- initialValue: "en",
100
+ options: [
101
+ { value: "en", label: "English" },
102
+ { value: "es", label: "Español" },
103
+ ],
102
104
  }),
103
105
 
104
106
  i18n: () =>
@@ -117,6 +119,30 @@ async function main() {
117
119
 
118
120
  // ── Replacements ──────────────────────────────────────────
119
121
 
122
+ const translations: Record<string, Record<string, string>> = {
123
+ en: {
124
+ T_TAGLINE: "Our Blog",
125
+ T_TITLE_LINE1: "Latest",
126
+ T_TITLE_LINE2: "Articles",
127
+ T_DESCRIPTION: "Welcome to our blog.",
128
+ T_BTNCTA: "Read more",
129
+ T_BTN_PREV: "Previous",
130
+ T_BTN_NEXT: "Next",
131
+ },
132
+ es: {
133
+ T_TAGLINE: "Nuestro Blog",
134
+ T_TITLE_LINE1: "Últimos",
135
+ T_TITLE_LINE2: "Artículos",
136
+ T_DESCRIPTION: "Bienvenido a nuestro blog.",
137
+ T_BTNCTA: "Leer más",
138
+ T_BTN_PREV: "Anterior",
139
+ T_BTN_NEXT: "Siguiente",
140
+ },
141
+ };
142
+
143
+ const locale = answers.locale as string;
144
+ const t = translations[locale] ?? translations["en"];
145
+
120
146
  const hasLayout = answers.hasLayout as boolean;
121
147
 
122
148
  const replacements: Record<string, string> = {
@@ -139,6 +165,7 @@ async function main() {
139
165
  LAYOUT_CLOSE: hasLayout
140
166
  ? `</Layout>`
141
167
  : ` </body>\n</html>`,
168
+ ...t
142
169
  };
143
170
 
144
171
  // ── Copia archivos ────────────────────────────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-blog-kit",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "A ready-to-use blog system for Astro with WordPress headless support, optional i18n, multiple layouts, and a comment system.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -9,13 +9,13 @@ const { posts, totalPages } = await wp.getPosts({ perPage: config.postsPerPage ?
9
9
 
10
10
  const t = {
11
11
  blog: {
12
- tagline: "Our Blog",
13
- title_line1: "Latest",
14
- title_line2: "Articles",
15
- description: "Welcome to our blog.",
16
- btncta: "Read more",
17
- btn_prev: "Previous",
18
- btn_next: "Next",
12
+ tagline: "__T_TAGLINE__",
13
+ title_line1: "__T_TITLE_LINE1__",
14
+ title_line2: "__T_TITLE_LINE2__",
15
+ description: "__T_DESCRIPTION__",
16
+ btncta: "__T_BTNCTA__",
17
+ btn_prev: "__T_BTN_PREV__",
18
+ btn_next: "__T_BTN_NEXT__",
19
19
  },
20
20
  };
21
21
 
@@ -14,13 +14,13 @@ const { posts, currentPage, totalPages } = Astro.props;
14
14
 
15
15
  const t = {
16
16
  blog: {
17
- tagline: "Our Blog",
18
- title_line1: "Latest",
19
- title_line2: "Articles",
20
- description: "Welcome to our blog.",
21
- btncta: "Read more",
22
- btn_prev: "Previous",
23
- btn_next: "Next",
17
+ tagline: "__T_TAGLINE__",
18
+ title_line1: "__T_TITLE_LINE1__",
19
+ title_line2: "__T_TITLE_LINE2__",
20
+ description: "__T_DESCRIPTION__",
21
+ btncta: "__T_BTNCTA__",
22
+ btn_prev: "__T_BTN_PREV__",
23
+ btn_next: "__T_BTN_NEXT__",
24
24
  },
25
25
  };
26
26
 
@@ -17,13 +17,13 @@ const comments = post.id ? await wp.getComments(post.id) : [];
17
17
 
18
18
  const t = {
19
19
  blog: {
20
- tagline: "Our Blog",
21
- title_line1: "Latest",
22
- title_line2: "Articles",
23
- description: "Welcome to our blog.",
24
- btncta: "Read more",
25
- btn_prev: "Back to blog",
26
- btn_next: "Next",
20
+ tagline: "__T_TAGLINE__",
21
+ title_line1: "__T_TITLE_LINE1__",
22
+ title_line2: "__T_TITLE_LINE2__",
23
+ description: "__T_DESCRIPTION__",
24
+ btncta: "__T_BTNCTA__",
25
+ btn_prev: "__T_BTN_PREV__",
26
+ btn_next: "__T_BTN_NEXT__",
27
27
  },
28
28
  };
29
29
  ---