Skip to content

Commit

Permalink
Merge pull request #4294 from apostrophecms/i18n-fix
Browse files Browse the repository at this point in the history
I18n fix
  • Loading branch information
BoDonkey authored Sep 28, 2023
2 parents 51cd251 + 5c077bd commit 387ff30
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
for everyone with this release. This is necessary because Vimeo stopped
offering oembed discovery meta tags on their video pages.

### Fixes

* The `118n` module now ignores non-JSON files within the i18n folder of any module and does not crash the build process.

## 3.56.0 (2023-09-13)

### Adds
Expand Down
8 changes: 8 additions & 0 deletions modules/@apostrophecms/i18n/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,15 @@ module.exports = {
self.namespaces[ns].browser = self.namespaces[ns].browser ||
(metadata[ns] && metadata[ns].browser);
const namespaceDir = path.join(localizationsDir, ns);
if (!fs.statSync(namespaceDir).isDirectory()) {
// Skip non-directory items, such as hidden files
continue;
}
for (const localizationFile of fs.readdirSync(namespaceDir)) {
if (!localizationFile.endsWith('.json')) {
// Exclude parsing of non-JSON files, like hidden files, in the namespace directory
continue;
}
const fullLocalizationFile = path.join(namespaceDir, localizationFile);
const data = JSON.parse(fs.readFileSync(fullLocalizationFile));
const locale = localizationFile.replace('.json', '');
Expand Down

0 comments on commit 387ff30

Please sign in to comment.