build
This commit is contained in:
parent
8671ce5a01
commit
47d0d27820
|
|
@ -0,0 +1,10 @@
|
|||
export declare function getTranslations(options: {
|
||||
namespace: string | string[];
|
||||
locale: string;
|
||||
}): {
|
||||
common: {
|
||||
action: {
|
||||
confirm: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.getTranslations = void 0;
|
||||
function getTranslations(options) {
|
||||
const { namespace, locale } = options;
|
||||
// 表示entity locale表示zh_CN
|
||||
let translations = {};
|
||||
return {
|
||||
common: {
|
||||
action: {
|
||||
confirm: '确定2',
|
||||
},
|
||||
},
|
||||
};
|
||||
// const getTranslations = (ns: string) => {
|
||||
// const entityName = ns.substring(0, 1).toUpperCase() + ns.substring(1);
|
||||
// const entityName2 = ns.toLowerCase();
|
||||
// try {
|
||||
// const data = require(`${entityName}/locales/${locale}.ts`).default;
|
||||
// assign(translations, {
|
||||
// [entityName2]: data,
|
||||
// });
|
||||
// }
|
||||
// catch (err) {
|
||||
// throw err
|
||||
// }
|
||||
// };
|
||||
// if (namespace instanceof Array) {
|
||||
// namespace.forEach((ns) => {
|
||||
// getTranslations(ns);
|
||||
// })
|
||||
// }
|
||||
// else {
|
||||
// getTranslations(namespace);
|
||||
// }
|
||||
// return translations;
|
||||
}
|
||||
exports.getTranslations = getTranslations;
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import { EntityDict, Aspect, Context } from 'oak-domain/lib/types';
|
||||
import { Feature } from '../types/Feature';
|
||||
export declare class Locales extends Feature<EntityDict, Context<EntityDict>, Record<string, Aspect<EntityDict, Context<EntityDict>>>> {
|
||||
get(namespace: string | string[], locale: string, scene: string): Promise<{
|
||||
translations: {
|
||||
common: {
|
||||
action: {
|
||||
confirm: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
}>;
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Locales = void 0;
|
||||
const Feature_1 = require("../types/Feature");
|
||||
class Locales extends Feature_1.Feature {
|
||||
async get(namespace, locale, scene) {
|
||||
const translations = await this.getAspectProxy().getTranslations({ namespace, locale }, scene);
|
||||
return {
|
||||
translations,
|
||||
};
|
||||
}
|
||||
}
|
||||
exports.Locales = Locales;
|
||||
Loading…
Reference in New Issue