astro-blog-kit 0.2.4 → 0.2.5

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
@@ -82,6 +82,28 @@ async function main() {
82
82
  }
83
83
  }
84
84
  );
85
+ const translations = {
86
+ en: {
87
+ T_TAGLINE: "Our Blog",
88
+ T_TITLE_LINE1: "Latest",
89
+ T_TITLE_LINE2: "Articles",
90
+ T_DESCRIPTION: "Welcome to our blog.",
91
+ T_BTNCTA: "Read more",
92
+ T_BTN_PREV: "Previous",
93
+ T_BTN_NEXT: "Next"
94
+ },
95
+ es: {
96
+ T_TAGLINE: "Nuestro Blog",
97
+ T_TITLE_LINE1: "\xDAltimos",
98
+ T_TITLE_LINE2: "Art\xEDculos",
99
+ T_DESCRIPTION: "Bienvenido a nuestro blog.",
100
+ T_BTNCTA: "Leer m\xE1s",
101
+ T_BTN_PREV: "Anterior",
102
+ T_BTN_NEXT: "Siguiente"
103
+ }
104
+ };
105
+ const locale = answers.locale;
106
+ const t = translations[locale] ?? translations["en"];
85
107
  const hasLayout = answers.hasLayout;
86
108
  const replacements = {
87
109
  WP_URL: answers.wpUrl,
@@ -99,7 +121,8 @@ async function main() {
99
121
  </head>
100
122
  <body>`,
101
123
  LAYOUT_CLOSE: hasLayout ? `</Layout>` : ` </body>
102
- </html>`
124
+ </html>`,
125
+ ...t
103
126
  };
104
127
  const cwd = process.cwd();
105
128
  const spinner2 = p.spinner();
package/cli.ts CHANGED
@@ -117,6 +117,30 @@ async function main() {
117
117
 
118
118
  // ── Replacements ──────────────────────────────────────────
119
119
 
120
+ const translations: Record<string, Record<string, string>> = {
121
+ en: {
122
+ T_TAGLINE: "Our Blog",
123
+ T_TITLE_LINE1: "Latest",
124
+ T_TITLE_LINE2: "Articles",
125
+ T_DESCRIPTION: "Welcome to our blog.",
126
+ T_BTNCTA: "Read more",
127
+ T_BTN_PREV: "Previous",
128
+ T_BTN_NEXT: "Next",
129
+ },
130
+ es: {
131
+ T_TAGLINE: "Nuestro Blog",
132
+ T_TITLE_LINE1: "Últimos",
133
+ T_TITLE_LINE2: "Artículos",
134
+ T_DESCRIPTION: "Bienvenido a nuestro blog.",
135
+ T_BTNCTA: "Leer más",
136
+ T_BTN_PREV: "Anterior",
137
+ T_BTN_NEXT: "Siguiente",
138
+ },
139
+ };
140
+
141
+ const locale = answers.locale as string;
142
+ const t = translations[locale] ?? translations["en"];
143
+
120
144
  const hasLayout = answers.hasLayout as boolean;
121
145
 
122
146
  const replacements: Record<string, string> = {
@@ -139,6 +163,7 @@ async function main() {
139
163
  LAYOUT_CLOSE: hasLayout
140
164
  ? `</Layout>`
141
165
  : ` </body>\n</html>`,
166
+ ...t
142
167
  };
143
168
 
144
169
  // ── 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.5",
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
  ---