WIP feature/ Dashboard_breadcrumbs & fix_localize

This commit is contained in:
elforjani3
2020-05-19 04:48:50 +02:00
parent e6f63fbc88
commit 67a23ce452
25 changed files with 269 additions and 133 deletions

View File

@@ -1,10 +1,10 @@
export default {
hello_world: 'Hello World',
email_or_phone_number: 'Email or phone number',
'email_or_phone_number': 'Email or phone number',
password: 'Password',
login: 'Login',
invalid_email_or_phone_number: 'Invalid email or phone number.',
required: 'Required',
'required': 'Required',
reset_password: 'Reset Password',
the_user_has_been_suspended_from_admin: 'The user has been suspended from the administrator.',
email_and_password_entered_did_not_match:
@@ -75,7 +75,6 @@ export default {
new_exchange_rate: 'New Exchange Rate',
delete_exchange_rate: 'Delete Exchange Rate',
exchange_rate: 'Exchange Rate',
currency_code: 'Currency Code',
edit_invite: 'Edit invite',
edit_category: 'Edit Category',
delete_category: 'Delete Category',
@@ -116,7 +115,7 @@ export default {
cancel: 'Cancel',
move_to_trash: 'Move to Trash',
save_new: 'Save & New',
journal_number: 'Journal number',
journal_number: 'Journal Number',
credit_currency: 'Credit ({currency})',
debit_currency: 'Debit ({currency})',
note: 'Note',
@@ -292,16 +291,35 @@ run_report:'Run Report',
num:'Num.',
acc_code:'Acc. Code',
display_report_columns:'Display report columns',
select_display_columns_by:'Select display columns by...'
select_display_columns_by:'Select display columns by...',
credit_and_debit_not_equal:'credit and debit not equal',
the_currency_has_been_successfully_edited:'The currency has been successfully edited',
the_currency_has_been_successfully_created:'The currency has been successfully created',
// Name Labels
expense_account_id :'Expense account',
payment_account_id: 'Payment account',
currency_code_: 'Currency code',
publish:'Publish',
exchange_rate_:'Exchange rate',
journal_number_:'Journal number',
first_name_: 'First name',
last_name_:'Last name',
phone_number_:'Phone number',
organization_name_:'Organization name',
confirm_password:'Confirm password',
crediential:'Email or Phone number',
account_type_id:'Account type',
account_name_:'Account name',
currency_name_:'Currency name',
cost_account_id:'Cost account',
sell_account_id:'Sell account',
item_type_:'Item type',
item_name_:'Item name',
organization_industry_:'Organization industry',
base_currency_:'Base currency',
date_format_:'Date format',
view_name_:'View name'
};

View File

@@ -0,0 +1,60 @@
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 beeeeee 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,48 @@
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,
);
}