mirror of
https://github.com/hexastack/hexabot
synced 2025-01-23 02:47:56 +00:00
fix: i18n dir scan
This commit is contained in:
parent
92bb4978c3
commit
a65e937003
@ -6,7 +6,7 @@
|
|||||||
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
|
* 2. All derivative works must include clear attribution to the original creator and software, Hexastack and Hexabot, in a prominent location (e.g., in the software's "About" section, documentation, and README file).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { promises as fs } from 'fs';
|
import { existsSync, promises as fs } from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
import { Injectable, OnModuleInit } from '@nestjs/common';
|
import { Injectable, OnModuleInit } from '@nestjs/common';
|
||||||
@ -86,11 +86,16 @@ export class I18nService<K = Record<string, unknown>>
|
|||||||
|
|
||||||
async loadExtensionI18nTranslations() {
|
async loadExtensionI18nTranslations() {
|
||||||
const baseDir = path.join(__dirname, '..', '..', 'extensions');
|
const baseDir = path.join(__dirname, '..', '..', 'extensions');
|
||||||
const extensionTypes = ['channels', 'plugins'];
|
const extensionTypes = ['channels', 'helpers', 'plugins'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (const type of extensionTypes) {
|
for (const type of extensionTypes) {
|
||||||
const extensionsDir = path.join(baseDir, type);
|
const extensionsDir = path.join(baseDir, type);
|
||||||
|
|
||||||
|
if (!existsSync(extensionsDir)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const extensionFolders = await fs.readdir(extensionsDir, {
|
const extensionFolders = await fs.readdir(extensionsDir, {
|
||||||
withFileTypes: true,
|
withFileTypes: true,
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user