Skip to content

Commit

Permalink
Merge branch 'main' into recurrence_widget_buttons_padding
Browse files Browse the repository at this point in the history
  • Loading branch information
sabrina-bongiovanni authored Jun 6, 2024
2 parents d4358f6 + 46b9d76 commit a53aedb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/scripts/i18n.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const babel = require('@babel/core');

const path = require('path');
const projectRootPath = path.resolve('.');
const packageJson = require(path.join(projectRootPath, 'package.json'));

const { program } = require('commander');
const chalk = require('chalk');
Expand Down Expand Up @@ -155,9 +154,9 @@ function poToJson({ registry, addonMode }) {
(item.comments[0] && item.comments[0].startsWith('. Default: ')
? item.comments[0].replace('. Default: ', '')
: item.comments[0] &&
item.comments[0].startsWith('defaultMessage:')
? item.comments[0].replace('defaultMessage: ', '')
: '')
item.comments[0].startsWith('defaultMessage:')
? item.comments[0].replace('defaultMessage: ', '')
: '')
: item.msgstr[0];
}
});
Expand All @@ -183,8 +182,11 @@ function poToJson({ registry, addonMode }) {

if (!addonMode) {
// Merge addons locales
if (packageJson.addons) {
registry.getAddonDependencies().forEach((addon) => {
registry.getAddonDependencies().forEach((addonDep) => {
// What comes from getAddonDependencies is in the form of `@package/addon:profile`
const addon = addonDep.split(':')[0];
// Check if the addon is available in the registry, just in case
if (registry.packages[addon]) {
const addonlocale = `${registry.packages[addon].modulePath}/../${filename}`;
if (fs.existsSync(addonlocale)) {
const addonItems = Pofile.parse(
Expand All @@ -197,9 +199,10 @@ function poToJson({ registry, addonMode }) {
console.log(`Merging ${addon} locales for ${lang}`);
}
}
});
}
}
});
}

// Merge project locales, the project customization wins
mergeMessages(result, projectLocalesItems, lang);
fs.writeFileSync(`locales/${lang}.json`, JSON.stringify(result));
Expand Down
1 change: 1 addition & 0 deletions packages/scripts/news/6073.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
'Fix `poToJson` script, making it support `volto.config.js` @sneridagh

0 comments on commit a53aedb

Please sign in to comment.