Generate LanguageTage.ts
This commit is contained in:
parent
aad89a2001
commit
eb64886dcf
@ -139,6 +139,20 @@ async function generateI18nMessages() {
|
||||
"messages_defaultSet"
|
||||
);
|
||||
|
||||
fs.writeFileSync(
|
||||
pathJoin(messagesDirPath, "LanguageTag.ts"),
|
||||
Buffer.from(
|
||||
[
|
||||
``,
|
||||
`export const languageTags = ${JSON.stringify(languages, null, 2)} as const;`,
|
||||
``,
|
||||
`export type LanguageTag = typeof languageTags[number];`,
|
||||
``
|
||||
].join("\n"),
|
||||
"utf8"
|
||||
)
|
||||
);
|
||||
|
||||
const generatedFileHeader = [
|
||||
`//This code was automatically generated by running ${pathRelative(
|
||||
thisCodebaseRootDirPath,
|
||||
|
@ -29,7 +29,9 @@ export function generateMessageProperties(params: {
|
||||
Object.fromEntries(
|
||||
fs
|
||||
.readdirSync(baseMessagesDirPath)
|
||||
.filter(baseName => baseName !== "index.ts")
|
||||
.filter(
|
||||
basename => basename !== "index.ts" && basename !== "LanguageTag.ts"
|
||||
)
|
||||
.map(basename => ({
|
||||
languageTag: basename.replace(/\.ts$/, ""),
|
||||
filePath: pathJoin(baseMessagesDirPath, basename)
|
||||
|
Loading…
x
Reference in New Issue
Block a user