re-structure to monorepo.

This commit is contained in:
a.bouhuolia
2023-02-03 01:02:31 +02:00
parent 8242ec64ba
commit 7a0a13f9d5
10400 changed files with 46966 additions and 17223 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
// @ts-nocheck
// Based on https://github.com/jquense/yup/blob/2973d0a/src/locale.js
import printValue from '../printValue';
export const locale = {
mixed: {
default: '${path} غير صالح.',
required: '${path} هو حقل مطلوب',
oneOf: '${path} يجب أن تكون واحدة من القيم التالية: ${values}',
notOneOf: '${path} لا يجب أن تكون واحدة من القيم التالية: ${values}',
notType: ({ path, type, value, originalValue }) => {
const isCast = originalValue != null && originalValue !== value;
let msg =
`${path} يجب أن يكون \`${type}\` نوع, ` +
`ولكن القيمة النهائية كانت في: \`${printValue(value, true)}\`` +
(isCast
? ` (المدلى بها من قيمة \`${printValue(originalValue, true)}\`).`
: '.');
if (value === null) {
msg +=
`\n إذا كان المقصود "لاغية" كقيمة فارغة مما لا شك فيه للاحتفال مخطط كما` +
' `.nullable()`';
}
return msg;
},
},
string: {
length: '${path} يجب أن يكون بالضبط ${length} حرفا',
min: '${path} يجب أن تكون على الأقل ${min} حرفا',
max: '${path} يجب أن تكون على الأكثر ${max} حرفا',
matches: '${path} يجب أن يطابق ما يلي: "${regex}"',
email: '${path} يجب أن يكون عنوان بريد إلكتروني صالح',
url: '${path} يجب أن يكون عنوان URL صالحا',
trim: '${path} يجب أن تكون سلسلة قلص',
lowercase: '${path} يجب أن تكون سلسلة صغيرة',
uppercase: '${path} يجب أن تكون سلسلة الحالة العلوي',
},
number: {
min: '${path} يجب أن تكون أكبر من أو يساوي ${min}',
max: '${path} يجب أن يكون أقل من أو يساوي ${max}',
lessThan: '${path} يجب أن يكون أقل من ${less}',
moreThan: '${path} يجب أن تكون أكبر من ${more}',
positive: '${path} يجب أن يكون رقما موجبا',
negative: '${path} يجب أن يكون رقما سالبا',
integer: '${path} يجب أن يكون رقما',
},
date: {
min: '${path} يجب أن يكون حقل في وقت لاحق من ${min}',
max: '${path} يجب أن يكون حقل في وقت سابق من ${max}',
},
boolean: {},
object: {
noUnknown: '${path} حقل لا يمكن أن يكون مفاتيح غير محددة في شكل وجوه',
},
array: {
min: 'يجب أن يكون ${path} حقل على الأقل ${min} من العناصر',
max: '${path} يجب أن يكون الحقل أقل من أو يساوي إلى ${max} من العناصر',
},
};

View File

@@ -0,0 +1,7 @@
// @ts-nocheck
export default {
"login": "Login",
"reset_password": "Reset password",
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,61 @@
// @ts-nocheck
import printValue from '../printValue';
export const locale = {
mixed: {
default: '${path} is invalid',
required: '${path} is a required field ',
oneOf: '${path} must be one of the following values: ${values}',
notOneOf: '${path} must not be one of the following values: ${values}',
notType: ({ path, type, value, originalValue }) => {
let isCast = originalValue != null && originalValue !== value;
let msg =
`${path} must be a \`${type}\` type, ` +
`but the final value was: \`${printValue(value, true)}\`` +
(isCast
? ` (cast from the value \`${printValue(originalValue, true)}\`).`
: '.');
if (value === null) {
msg += `\n If "null" is intended as an empty value be sure to mark the schema as \`.nullable()\``;
}
return msg;
},
defined: '${path} must be defined',
},
string: {
length: '${path} must be exactly ${length} characters',
min: '${path} must be at least ${min} characters',
max: '${path} must be at most ${max} characters',
matches: '${path} must match the following: "${regex}"',
email: '${path} must be a valid email',
url: '${path} must be a valid URL',
trim: '${path} must be a trimmed string',
lowercase: '${path} must be a lowercase string',
uppercase: '${path} must be a upper case string',
},
number: {
min: '${path} must be greater than or equal to ${min}',
max: '${path} must be less than or equal to ${max}',
lessThan: '${path} must be less than ${less}',
moreThan: '${path} must be greater than ${more}',
notEqual: '${path} must be not equal to ${notEqual}',
positive: '${path} must be a positive number',
negative: '${path} must be a negative number',
integer: '${path} must be an integer',
},
date: {
min: '${path} field must be later than ${min}',
max: '${path} field must be at earlier than ${max}',
},
boolean: {},
object: {
noUnknown:
'${path} field cannot have keys not specified in the object shape',
},
array: {
min: '${path} field must have at least ${min} items',
max: '${path} field must have less than or equal to ${max} items',
},
};

View File

@@ -0,0 +1,49 @@
// @ts-nocheck
const toString = Object.prototype.toString;
const errorToString = Error.prototype.toString;
const regExpToString = RegExp.prototype.toString;
const symbolToString =
typeof Symbol !== 'undefined' ? Symbol.prototype.toString : () => '';
const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
function printNumber(val) {
if (val !== +val) return 'NaN';
const isNegativeZero = val === 0 && 1 / val < 0;
return isNegativeZero ? '-0' : '' + val;
}
function printSimpleValue(val, quoteStrings = false) {
if (val == null || val === true || val === false) return '' + val;
const typeOf = typeof val;
if (typeOf === 'number') return printNumber(val);
if (typeOf === 'string') return quoteStrings ? `"${val}"` : val;
if (typeOf === 'function')
return '[Function ' + (val.name || 'anonymous') + ']';
if (typeOf === 'symbol')
return symbolToString.call(val).replace(SYMBOL_REGEXP, 'Symbol($1)');
const tag = toString.call(val).slice(8, -1);
if (tag === 'Date')
return isNaN(val.getTime()) ? '' + val : val.toISOString(val);
if (tag === 'Error' || val instanceof Error)
return '[' + errorToString.call(val) + ']';
if (tag === 'RegExp') return regExpToString.call(val);
return null;
}
export default function printValue(value, quoteStrings) {
let result = printSimpleValue(value, quoteStrings);
if (result !== null) return result;
return JSON.stringify(
value,
function(key, value) {
let result = printSimpleValue(this[key], quoteStrings);
if (result !== null) return result;
return value;
},
2,
);
}