feat(admin-*,dashboard): add dashboard i18n extensions (#13763)
* virtual i18n module
* changeset
* fallback ns
fallback to the default "translation" ns if the key isnt found. Allows to use a single "useTranslation("customNs")" hook for both custom and medusa-provided keys
* simplify merges
* optional for backward compat
* fix HMR
* fix generated deepMerge
* test
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { crawl } from "../utils"
|
||||
|
||||
/**
|
||||
* Get i18n index files from sources
|
||||
* Looks for src/admin/i18n/index.ts in each source
|
||||
*/
|
||||
export async function getI18nIndexFilesFromSources(
|
||||
sources: Set<string>
|
||||
): Promise<string[]> {
|
||||
return (await Promise.all(
|
||||
Array.from(sources).map(async (source) =>
|
||||
crawl(`${source}/i18n`, "index", { min: 0, max: 0 })
|
||||
)
|
||||
)).flat()
|
||||
}
|
||||
Reference in New Issue
Block a user