import { useMemo, createElement } from "react";
import { emptyObject } from "@contember/react-utils";
import { defaultLocale } from "./defaultLocale.js";
import { DictionaryResolver } from "./DictionaryResolver.js";
import { I18nContext } from "./I18nContext.js";
function I18nProvider({ localeCode, dictionaries = emptyObject, children }) {
  const locale = useMemo(() => ({ code: localeCode || defaultLocale.code }), [localeCode]);
  const metadata = useMemo(() => ({
    locale,
    dictionaryResolver: new DictionaryResolver(dictionaries)
  }), [dictionaries, locale]);
  return /* @__PURE__ */ createElement(I18nContext.Provider, {
    value: metadata
  }, children);
}
export { I18nProvider };
//# sourceMappingURL=I18nProvider.js.map
