Remove lingui (#1874)

* remove lingui

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* babelless

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* tweak ts-loader options

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>

* tweak renderer webpack config

Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
Jari Kolehmainen authored and GitHub committed 2020-12-29 14:53:34 +02:00
1 parent 050603a7b3
commit a03da3c572
163 files changed
+1140 -12003

No files matched your search

@@ -1,7 +1,5 @@
import type { InputProps } from "./input";
import { ReactNode } from "react";
import { t } from "@lingui/macro";
import { _i18n } from "../../i18n";
import fse from "fs-extra";
export interface InputValidator {
@@ -13,19 +11,19 @@ export interface InputValidator {
export const isRequired: InputValidator = {
condition: ({ required }) => required,
message: () => _i18n._(t`This field is required`),
message: () => `This field is required`,
validate: value => !!value.trim(),
};
export const isEmail: InputValidator = {
condition: ({ type }) => type === "email",
message: () => _i18n._(t`Wrong email format`),
message: () => `Wrong email format`,
validate: value => !!value.match(/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),
};
export const isNumber: InputValidator = {
condition: ({ type }) => type === "number",
message: () => _i18n._(t`Invalid number`),
message: () => `Invalid number`,
validate: (value, { min, max }) => {
const numVal = +value;
@@ -39,7 +37,7 @@ export const isNumber: InputValidator = {
export const isUrl: InputValidator = {
condition: ({ type }) => type === "url",
message: () => _i18n._(t`Wrong url format`),
message: () => `Wrong url format`,
validate: value => {
try {
return Boolean(new URL(value));
@@ -51,31 +49,31 @@ export const isUrl: InputValidator = {
export const isPath: InputValidator = {
condition: ({ type }) => type === "text",
message: () => _i18n._(t`This field must be a valid path`),
message: () => `This field must be a valid path`,
validate: value => value && fse.pathExistsSync(value),
};
export const minLength: InputValidator = {
condition: ({ minLength }) => !!minLength,
message: (value, { minLength }) => _i18n._(t`Minimum length is ${minLength}`),
message: (value, { minLength }) => `Minimum length is ${minLength}`,
validate: (value, { minLength }) => value.length >= minLength,
};
export const maxLength: InputValidator = {
condition: ({ maxLength }) => !!maxLength,
message: (value, { maxLength }) => _i18n._(t`Maximum length is ${maxLength}`),
message: (value, { maxLength }) => `Maximum length is ${maxLength}`,
validate: (value, { maxLength }) => value.length <= maxLength,
};
const systemNameMatcher = /^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$/;
export const systemName: InputValidator = {
message: () => _i18n._(t`A System Name must be lowercase DNS labels separated by dots. DNS labels are alphanumerics and dashes enclosed by alphanumerics.`),
message: () => `A System Name must be lowercase DNS labels separated by dots. DNS labels are alphanumerics and dashes enclosed by alphanumerics.`,
validate: value => !!value.match(systemNameMatcher),
};
export const accountId: InputValidator = {
message: () => _i18n._(t`Invalid account ID`),
message: () => `Invalid account ID`,
validate: value => (isEmail.validate(value) || systemName.validate(value))
};
@@ -1,9 +1,7 @@
import "./search-input.scss";
import React, { createRef } from "react";
import { t } from "@lingui/macro";
import { observer } from "mobx-react";
import { _i18n } from "../../i18n";
import { autobind, cssNames } from "../../utils";
import { Icon } from "../icon";
import { Input, InputProps } from "./input";
@@ -20,7 +18,7 @@ const defaultProps: Partial<Props> = {
bindGlobalFocusHotkey: true,
showClearIcon: true,
get placeholder() {
return _i18n._(t`Search...`);
return `Search...`;
},
};