Skip to content

Commit

Permalink
simplify namespace generation function
Browse files Browse the repository at this point in the history
  • Loading branch information
pettinarip committed Dec 10, 2022
1 parent 5b5c9ca commit d411fce
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/scripts/scanTranslations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,10 @@ const input = ["./src/**/*.{ts,tsx}"]
const output = "./i18n"

function getNamespaceFromFilename(filename: string) {
const cwd = process.cwd()
const dirname = path.dirname(filename)
const dir = dirname.replace(cwd + "/", "")
const basename = path.basename(filename, ".tsx")
const namespace = dir + "/" + basename

return namespace.replaceAll("/", "-")
const file = path.parse(filename)
const dir = file.dir.slice(filename.indexOf("src/"))
const namespace = dir.replaceAll("/", "-") + "-" + file.name
return namespace
}

function customTransform(file, enc, done) {
Expand Down

0 comments on commit d411fce

Please sign in to comment.