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.
|
|
68
|
+
locale: () => p.select({
|
|
69
69
|
message: "Default locale",
|
|
70
|
-
|
|
71
|
-
|
|
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.
|
|
98
|
+
p.select({
|
|
99
99
|
message: "Default locale",
|
|
100
|
-
|
|
101
|
-
|
|
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
|
@@ -9,13 +9,13 @@ const { posts, totalPages } = await wp.getPosts({ perPage: config.postsPerPage ?
|
|
|
9
9
|
|
|
10
10
|
const t = {
|
|
11
11
|
blog: {
|
|
12
|
-
tagline: "
|
|
13
|
-
title_line1: "
|
|
14
|
-
title_line2: "
|
|
15
|
-
description: "
|
|
16
|
-
btncta: "
|
|
17
|
-
btn_prev: "
|
|
18
|
-
btn_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: "
|
|
18
|
-
title_line1: "
|
|
19
|
-
title_line2: "
|
|
20
|
-
description: "
|
|
21
|
-
btncta: "
|
|
22
|
-
btn_prev: "
|
|
23
|
-
btn_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: "
|
|
21
|
-
title_line1: "
|
|
22
|
-
title_line2: "
|
|
23
|
-
description: "
|
|
24
|
-
btncta: "
|
|
25
|
-
btn_prev: "
|
|
26
|
-
btn_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
|
---
|