Skip to content

Commit

Permalink
get defaultLanguage
Browse files Browse the repository at this point in the history
  • Loading branch information
lionellbriones committed Oct 11, 2022
1 parent c3be608 commit 185dd00
Show file tree
Hide file tree
Showing 13 changed files with 61,512 additions and 20 deletions.
21 changes: 13 additions & 8 deletions locales/importLocales.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,24 @@ function getLocale() {
getLocale()
.then((result) => {
const locales = result.data;
const folder = "./packages/ui/src/i18n/";
const folderPath = path.resolve(folder);
if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
}
const folders = ["./packages/ui/src/i18n/"];
folders.forEach((folder) => {
const folderPath = path.resolve(folder);

if (!fs.existsSync(folderPath)) {
fs.mkdirSync(folderPath);
}
});

// Create json files
const keys = Object.keys(locales);
for (const localeKey of keys) {
if (Object.prototype.hasOwnProperty.call(locales, localeKey)) {
const filePath = path.resolve(`${folder}${localeKey}.json`);
fs.writeFile(filePath, JSON.stringify(locales[localeKey], null, 2), { flag: "w" }, (error) => {
if (error) throw error;
folders.forEach((folder) => {
const filePath = path.resolve(`${folder}${localeKey}.json`);
fs.writeFile(filePath, JSON.stringify(locales[localeKey], null, 2), { flag: "w" }, (error) => {
if (error) throw error;
});
});
}
}
Expand Down
Loading

0 comments on commit 185dd00

Please sign in to comment.