Skip to content

Commit

Permalink
✨ feat(format): Modify formatJSON function for i18n workflow
Browse files Browse the repository at this point in the history
This commit introduces changes to the format.mjs file. The formatJSON
function has been modified to handle the i18n workflow. The changes
involve setting values in the rawData object based on selectors and
checking for the existence of rawData before executing certain code.

Changes made:
- Modifications to the formatJSON function for i18n workflow

The purpose of these changes is to improve the functionality and
performance of the i18n workflow in the formatJSON function.
  • Loading branch information
canisminor1990 committed Sep 6, 2023
1 parent 51e55ce commit d127683
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/format.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ const formatJSON = async (fileName, checkType) => {
}

// i18n workflow
if (typeof plugin.meta.title === 'string' && typeof plugin.meta.description === 'string') {
let rawData = {};
let rawData = {};

for (const key of config.selectors) {
set(rawData, key, get(plugin, key));
}
for (const key of config.selectors) {
const rawValue = get(plugin, key);
if (rawValue) set(rawData, key, rawValue);
}

if (rawData) {
if (plugin.locale && plugin.locale !== config.entryLocale) {
if (config.outputLocales.includes(plugin.locale)) {
writeFileSync(
Expand Down

0 comments on commit d127683

Please sign in to comment.