Skip to content

Commit

Permalink
feat: lang codes
Browse files Browse the repository at this point in the history
  • Loading branch information
vltansky committed Jun 8, 2020
1 parent 316299f commit 09cb6a8
Show file tree
Hide file tree
Showing 2 changed files with 794 additions and 742 deletions.
6 changes: 4 additions & 2 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ const onLoad = async (targetDir, version) => {
type: "autocomplete",
name: "lang",
message: "Select language",
choices: langs,
choices: langs.map((code) => {
return { title: code };
}),
},
];

Expand All @@ -79,7 +81,7 @@ const onLoad = async (targetDir, version) => {
const sourceHTML = await fs.readFile(indexFile, "utf-8");
const resultHTML = sourceHTML.replace(
/(<html.*lang=)\"([^"]*)\"/gi,
`$1"${lang}"`
`$1"${lang || ""}"`
);
await fs.writeFile(indexFile, resultHTML);
} catch (err) {
Expand Down
Loading

0 comments on commit 09cb6a8

Please sign in to comment.