import { DomainServiceProvider } from "./context/domainService";
import { defaultLang, theme } from "./constant";
import { useTracker } from "./hook/useTracker";
import { RouterElements } from "./router";
import { ConfigProvider } from "antd";
import { useI18n } from "@tavi/i18n";
import "./styles/app.less";

/**
 * 国际化
 */
export const { i18n } = useI18n({
  loadPath: "/locales/{{lng}}/{{ns}}.json",
  fallbackLng: defaultLang,
  debug: false,
});

export const App = () => {
  useTracker();

  return (
    <DomainServiceProvider>
      <ConfigProvider theme={theme}>
        <RouterElements />
      </ConfigProvider>
    </DomainServiceProvider>
  );
};
