-import { initializeSite } from "@utils/app";
-import setDefaultOptions from "date-fns/setDefaultOptions";
+import { initializeSite, setupI18Next as setupDateFns } from "@utils/app";
import { hydrate } from "inferno-hydrate";
import { Router } from "inferno-router";
import { App } from "../shared/components/app/app";
-import { HistoryService, I18NextService } from "../shared/services";
+import { HistoryService } from "../shared/services";
import "bootstrap/js/dist/collapse";
import "bootstrap/js/dist/dropdown";
async function startClient() {
initializeSite(window.isoData.site_res);
- const lang = I18NextService.i18n.language;
- const locale = (
- await import(
- /* webpackExclude: /\.js\.flow$/ */
- `date-fns/locale/${lang}`
- )
- ).default;
-
- setDefaultOptions({
- locale,
- });
+ await setupDateFns();
const wrapper = (
<Router history={HistoryService.history}>
-import setDefaultOptions from "date-fns/setDefaultOptions";
+import { setupI18Next as setupDateFns } from "@utils/app";
import express from "express";
import path from "path";
import process from "process";
-import { I18NextService } from "../shared/services";
import CatchAllHandler from "./handlers/catch-all-handler";
import ManifestHandler from "./handlers/manifest-handler";
import RobotsHandler from "./handlers/robots-handler";
server.get("/*", CatchAllHandler);
server.listen(Number(port), hostname, () => {
+ setupDateFns();
console.log(`http://${hostname}:${port}`);
});
-process.on("SIGINT", async () => {
- const lang = I18NextService.i18n.language;
- const locale = (
- await import(
- /* webpackExclude: /\.js\.flow$/ */
- `date-fns/locale/${lang}`
- )
- ).default;
- setDefaultOptions({
- locale,
- });
+process.on("SIGINT", () => {
console.info("Interrupted");
process.exit(0);
});
import selectableLanguages from "./selectable-languages";
import setIsoData from "./set-iso-data";
import setTheme from "./set-theme";
+import setupI18Next from "./setup-date-fns";
import showAvatars from "./show-avatars";
import showLocal from "./show-local";
import showScores from "./show-scores";
selectableLanguages,
setIsoData,
setTheme,
+ setupI18Next,
showAvatars,
showLocal,
showScores,
--- /dev/null
+import setDefaultOptions from "date-fns/setDefaultOptions";
+import { I18NextService } from "../../services";
+
+export default async function () {
+ let lang = I18NextService.i18n.language;
+ if (lang === "en") {
+ lang = "en-US";
+ }
+
+ const locale = (
+ await import(
+ /* webpackExclude: /\.js\.flow$/ */
+ `date-fns/locale/${lang}`
+ )
+ ).default;
+ setDefaultOptions({
+ locale,
+ });
+}