mirror of
https://github.com/outline/outline.git
synced 2026-12-01 17:32:49 +03:00
Revert "Using dynamic import for locale"
This reverts commit 7f0fc684cf.
This commit is contained in:
1 parent
7f0fc684cf
commit
e7dab890fe
3 files changed
+12
-40
No files matched your search
@@ -22,7 +22,6 @@ sharedmemory.heap_size=3221225472
|
||||
|
||||
module.system.node.resolve_dirname=node_modules
|
||||
module.system.node.resolve_dirname=app
|
||||
module.ignore_non_literal_requires=true
|
||||
|
||||
module.name_mapper='^\(.*\)\.md$' -> 'empty/object'
|
||||
module.name_mapper='^shared\/\(.*\)$' -> '<PROJECT_ROOT>/shared/\1'
|
||||
|
||||
@@ -4,20 +4,17 @@ import * as React from "react";
|
||||
import Tooltip from "components/Tooltip";
|
||||
import useUserLocale from "hooks/useUserLocale";
|
||||
|
||||
const getLocale = (locale: string) =>
|
||||
require(`date-fns/locale/${locale}/index.js`);
|
||||
|
||||
const locales = {
|
||||
en_US: "en-US",
|
||||
de_DE: "de",
|
||||
es_ES: "es",
|
||||
fr_FR: "fr",
|
||||
it_IT: "it",
|
||||
ko_KR: "ko",
|
||||
pt_BR: "pt-BR",
|
||||
pt_PT: "pt",
|
||||
zh_CN: "zh-CN",
|
||||
ru_RU: "ru",
|
||||
en_US: require(`date-fns/locale/en-US`),
|
||||
de_DE: require(`date-fns/locale/de`),
|
||||
es_ES: require(`date-fns/locale/es`),
|
||||
fr_FR: require(`date-fns/locale/fr`),
|
||||
it_IT: require(`date-fns/locale/it`),
|
||||
ko_KR: require(`date-fns/locale/ko`),
|
||||
pt_BR: require(`date-fns/locale/pt-BR`),
|
||||
pt_PT: require(`date-fns/locale/pt`),
|
||||
zh_CN: require(`date-fns/locale/zh-CN`),
|
||||
ru_RU: require(`date-fns/locale/ru`),
|
||||
};
|
||||
|
||||
let callbacks = [];
|
||||
@@ -36,12 +33,6 @@ function eachMinute(fn) {
|
||||
};
|
||||
}
|
||||
|
||||
function customFormatDistanceToNow(date: number, options = {}) {
|
||||
return formatDistanceToNow(date, {
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
||||
type Props = {
|
||||
dateTime: string,
|
||||
children?: React.Node,
|
||||
@@ -73,13 +64,11 @@ function LocaleTime({
|
||||
};
|
||||
}, []);
|
||||
|
||||
let content = customFormatDistanceToNow(Date.parse(dateTime), {
|
||||
let content = formatDistanceToNow(Date.parse(dateTime), {
|
||||
addSuffix,
|
||||
locale: userLocale ? getLocale(locales[userLocale]) : undefined,
|
||||
locale: userLocale ? locales[userLocale] : undefined,
|
||||
});
|
||||
|
||||
console.log(content);
|
||||
|
||||
if (shorten) {
|
||||
content = content
|
||||
.replace("about", "")
|
||||
|
||||
@@ -7,19 +7,6 @@ const pkg = require("rich-markdown-editor/package.json");
|
||||
const WebpackPwaManifest = require("webpack-pwa-manifest");
|
||||
const WorkboxPlugin = require("workbox-webpack-plugin");
|
||||
|
||||
const supportedLocales = [
|
||||
"en-US",
|
||||
"de",
|
||||
"es",
|
||||
"fr",
|
||||
"it",
|
||||
"zh-CN",
|
||||
"ko",
|
||||
"pt-BR",
|
||||
"pt",
|
||||
"ru",
|
||||
];
|
||||
|
||||
require('dotenv').config({ silent: true });
|
||||
|
||||
module.exports = {
|
||||
@@ -100,9 +87,6 @@ module.exports = {
|
||||
maximumFileSizeToCacheInBytes: 15 * 1024 * 1024, // For large bundles
|
||||
}),
|
||||
new RelativeCiAgentWebpackPlugin(),
|
||||
new webpack.ContextReplacementPlugin(
|
||||
/date\-fns[\/\\]/,
|
||||
new RegExp(`[/\\\\\](${supportedLocales.join('|')})[/\\\\\]index\.js$`))
|
||||
],
|
||||
stats: {
|
||||
assets: false,
|
||||
|
||||
Reference in new issue
Block a user