tachybase_todo/packages/plugins/@nocobase/plugin-client/src/server/cron.ts
sealday 3e58c54aa8 feat: 仓库二期 (#719)
Co-authored-by: hello@lv <2256334253@qq.com>
Co-authored-by: wjh <wwwjh0710@163.com>
Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#719
2024-05-08 16:20:31 +08:00

20 lines
556 B
TypeScript

import { requireModule } from '@tachybase/utils';
import { resolve } from 'path';
export const getCronLocale = (lang: string) => {
const lng = lang.replace('-', '_');
const files = [resolve(__dirname, `./../locale/cron/${lng}`)];
if (process.env.APP_ENV !== 'production') {
files.push(`@tachybase/client/src/locale/cron/${lng}`, `@tachybase/client/lib/locale/cron/${lng}`);
}
for (const file of files) {
try {
require.resolve(file);
return requireModule(file);
} catch (error) {
continue;
}
}
return {};
};