/** * This file is part of the NocoBase (R) project. * Copyright (c) 2020-2024 NocoBase Co., Ltd. * Authors: NocoBase Team. * * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License. * For more information, please refer to: https://www.nocobase.com/agreement. */ import { Cache } from '@nocobase/cache'; import { Registry } from '@nocobase/utils'; import Application from '../application'; export interface ResourceStorer { getResources(lang: string): Promise<{ [ns: string]: Record; }>; reset?: () => Promise; } export declare class Locale { app: Application; cache: Cache; defaultLang: string; localeFn: Map; resourceCached: Map; i18nInstances: Map; resourceStorers: Registry; constructor(app: Application); load(): Promise; reset(): Promise; reload(): Promise; setLocaleFn(name: string, fn: (lang: string) => Promise): void; registerResourceStorer(name: string, storer: ResourceStorer): void; get(lang: string): Promise<{ resources: any; }>; wrapCache(key: string, fn: () => any): Promise; loadResourcesByLang(lang: string): Promise; getCacheResources(lang: string): Promise; getResources(lang: string): Promise<{}>; getI18nInstance(lang: string): Promise; }