@sofit/view-locale 1.92.0 → 1.94.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/coverage/jest/results.xml +7 -7
- package/dist/runner.js +5 -6
- package/dist/translations/common/database-errors.d.ts +8 -0
- package/dist/translations/common/database-errors.js +8 -0
- package/dist/translations/common/internal-server-errors.d.ts +10 -0
- package/dist/translations/common/internal-server-errors.js +12 -0
- package/dist/translations/common/joi.js +4 -0
- package/dist/translations/index.d.ts +1 -0
- package/dist/translations/index.js +2 -0
- package/lib/runner.ts +5 -7
- package/lib/translations/common/database-errors.ts +8 -0
- package/lib/translations/common/internal-server-errors.ts +10 -0
- package/lib/translations/common/joi.ts +4 -0
- package/lib/translations/index.ts +1 -0
- package/package.json +1 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
<testsuites name="Sofit view locale tests" tests="8" failures="0" time="
|
|
2
|
-
<testsuite name="Joi tests" errors="0" failures="0" skipped="0" timestamp="2020-
|
|
1
|
+
<testsuites name="Sofit view locale tests" tests="8" failures="0" time="2.466">
|
|
2
|
+
<testsuite name="Joi tests" errors="0" failures="0" skipped="0" timestamp="2020-05-18T17:20:27" time="1.757" tests="4">
|
|
3
3
|
<testcase classname="Joi tests should return default message" name="Joi tests should return default message" time="0.003">
|
|
4
4
|
</testcase>
|
|
5
|
-
<testcase classname="Joi tests should return non label message" name="Joi tests should return non label message" time="0">
|
|
5
|
+
<testcase classname="Joi tests should return non label message" name="Joi tests should return non label message" time="0.001">
|
|
6
6
|
</testcase>
|
|
7
7
|
<testcase classname="Joi tests should return translated label message" name="Joi tests should return translated label message" time="0">
|
|
8
8
|
</testcase>
|
|
9
|
-
<testcase classname="Joi tests should return translated label index" name="Joi tests should return translated label index" time="0">
|
|
9
|
+
<testcase classname="Joi tests should return translated label index" name="Joi tests should return translated label index" time="0.001">
|
|
10
10
|
</testcase>
|
|
11
11
|
</testsuite>
|
|
12
|
-
<testsuite name="Vehicle locale test" errors="0" failures="0" skipped="0" timestamp="2020-
|
|
12
|
+
<testsuite name="Vehicle locale test" errors="0" failures="0" skipped="0" timestamp="2020-05-18T17:20:27" time="1.749" tests="4">
|
|
13
13
|
<testcase classname="Vehicle locale test Should get translations with reach" name="Vehicle locale test Should get translations with reach" time="0.003">
|
|
14
14
|
</testcase>
|
|
15
|
-
<testcase classname="Vehicle locale test Should replace correctly with reach" name="Vehicle locale test Should replace correctly with reach" time="0">
|
|
15
|
+
<testcase classname="Vehicle locale test Should replace correctly with reach" name="Vehicle locale test Should replace correctly with reach" time="0.001">
|
|
16
16
|
</testcase>
|
|
17
|
-
<testcase classname="Vehicle locale test Should get translations with raw" name="Vehicle locale test Should get translations with raw" time="0
|
|
17
|
+
<testcase classname="Vehicle locale test Should get translations with raw" name="Vehicle locale test Should get translations with raw" time="0">
|
|
18
18
|
</testcase>
|
|
19
19
|
<testcase classname="Vehicle locale test Should replace correctly with raw" name="Vehicle locale test Should replace correctly with raw" time="0">
|
|
20
20
|
</testcase>
|
package/dist/runner.js
CHANGED
|
@@ -23,12 +23,11 @@ class Locale {
|
|
|
23
23
|
reach(accessKey, replaces) {
|
|
24
24
|
let text = accessKey[this.language];
|
|
25
25
|
if (Boolean(text)) {
|
|
26
|
-
if (replaces
|
|
27
|
-
for (const key
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
26
|
+
if (replaces) {
|
|
27
|
+
for (const key of Object.keys(replaces)) {
|
|
28
|
+
const value = replaces[key];
|
|
29
|
+
const regex = new RegExp(String.raw `{{${key}}}`, 'g');
|
|
30
|
+
text = text.replace(regex, value);
|
|
32
31
|
}
|
|
33
32
|
}
|
|
34
33
|
return text;
|
|
@@ -36,5 +36,13 @@ exports.databaseErrors = {
|
|
|
36
36
|
duplicate_registers_relation: {
|
|
37
37
|
ptBR: 'Há mais de um registro para o campo {{column}}.',
|
|
38
38
|
es: 'Hay más de un registro para el campo {{column}}.'
|
|
39
|
+
},
|
|
40
|
+
connection_failed: {
|
|
41
|
+
ptBR: 'Falha de conexão com o banco de dados',
|
|
42
|
+
es: 'La conexión a la base de datos falló'
|
|
43
|
+
},
|
|
44
|
+
invalid_input_type: {
|
|
45
|
+
ptBR: 'O valor {{value}} está no formato incorreto',
|
|
46
|
+
es: 'El valor {{value}} está en el formato incorrecto'
|
|
39
47
|
}
|
|
40
48
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.internalServerErrors = {
|
|
4
|
+
non_reconized_error: {
|
|
5
|
+
ptBR: 'Ocorreu um erro não identificado. Por favor, entre em contato com nosso suporte via e-mail: <a href=\"mailto:{{email}}\">{{email}}</a>.',
|
|
6
|
+
es: 'Ha ocurrido un error no identificado. Póngase en contacto con nuestro soporte por correo electrónico: <a href=\"mailto:{{email}}\">{{email}}</a>.'
|
|
7
|
+
},
|
|
8
|
+
non_reconized_error_for_admin: {
|
|
9
|
+
ptBR: 'Ocorreu o seguinte erro: {{error}}<br>Favor contatar o desenvolvimento.',
|
|
10
|
+
es: 'Se produjo el siguiente error: {{error}}<br>Póngase en contacto con el desarrollador.'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
@@ -25,6 +25,10 @@ exports.joi = {
|
|
|
25
25
|
ptBR: '{{label}} precisa ter no mínimo {{limit}}.',
|
|
26
26
|
es: '{{label}} debe tener al menos {{limit}}.'
|
|
27
27
|
},
|
|
28
|
+
'number.max': {
|
|
29
|
+
ptBR: '{{label}} precisa ter no máximo {{limit}}.',
|
|
30
|
+
es: '{{label}} debe tener al máximo {{limit}}.'
|
|
31
|
+
},
|
|
28
32
|
'number.integer': {
|
|
29
33
|
ptBR: '{{label}} precisa ser um número inteiro.',
|
|
30
34
|
es: '{{label}} debe ser un entero.'
|
|
@@ -90,4 +90,5 @@ import * as warehouse from './modules/warehouse';
|
|
|
90
90
|
import * as warehouse_item from './modules/warehouse_item';
|
|
91
91
|
export { joi } from './common/joi';
|
|
92
92
|
export { databaseErrors } from './common/database-errors';
|
|
93
|
+
export { internalServerErrors } from './common/internal-server-errors';
|
|
93
94
|
export { auth, benchmarking, general, inout, pipefy, carsharing_type, cash_basis, change_history, checklist, checklist_group, checklist_group_item, checklist_group_option, checklist_model, checklist_reply, company, cost_center, cost_sharing, cost_sharing_entity, customer, driver_control, driver_license_point, employee, employee_change_history, employee_hiring_regime, employee_role, expense, fine, fine_qualification_integration_key, fine_qualification, fine_resource, foreseen_maintenance_plan_service_item, foreseen_service_order_item, gas_pump_control, gate, gate_appointment, gate_appointment_diary, item, leasing_contract, leasing_measurement, maintenance_plan, maintenance_plan_service, measurement_unit, night_transport, parameter, pendency, qualification_severity, release_notification, request_occurrence, route, service_order, solicitation, solicitation_comment, solicitation_history, solicitation_watcher, stock_transfer, stock_transfer_item, stock_entry_item, sub_system, subsidiary, supplier, system, tire_brand, tire_dimension, tire_drawing, transaction, trip, vehicle, vehicle_axes, vehicle_booking, vehicle_brand, vehicle_bulk, vehicle_bulk_keys, vehicle_change_history, vehicle_deactivation_cause, vehicle_due, vehicle_event, vehicle_event_type, vehicle_fuel, vehicle_layout, vehicle_leasing, vehicle_maintenance_plan, vehicle_maintenance_plan_item, vehicle_maintenance_plan_service, vehicle_model, vehicle_model_version, vehicle_tag, warehouse, warehouse_item, city, state };
|
|
@@ -191,3 +191,5 @@ var joi_1 = require("./common/joi");
|
|
|
191
191
|
exports.joi = joi_1.joi;
|
|
192
192
|
var database_errors_1 = require("./common/database-errors");
|
|
193
193
|
exports.databaseErrors = database_errors_1.databaseErrors;
|
|
194
|
+
var internal_server_errors_1 = require("./common/internal-server-errors");
|
|
195
|
+
exports.internalServerErrors = internal_server_errors_1.internalServerErrors;
|
package/lib/runner.ts
CHANGED
|
@@ -32,16 +32,14 @@ export class Locale {
|
|
|
32
32
|
|
|
33
33
|
if (Boolean(text)) {
|
|
34
34
|
|
|
35
|
-
if (replaces
|
|
35
|
+
if (replaces) {
|
|
36
36
|
|
|
37
|
-
for (const key
|
|
37
|
+
for (const key of Object.keys(replaces)) {
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
const value = replaces[key];
|
|
40
|
+
const regex = new RegExp(String.raw`{{${key}}}`, 'g');
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
text = text.replace(`{{${key}}}`, value);
|
|
44
|
-
}
|
|
42
|
+
text = text.replace(regex, value);
|
|
45
43
|
}
|
|
46
44
|
}
|
|
47
45
|
|
|
@@ -34,5 +34,13 @@ export const databaseErrors = {
|
|
|
34
34
|
duplicate_registers_relation: {
|
|
35
35
|
ptBR: 'Há mais de um registro para o campo {{column}}.',
|
|
36
36
|
es: 'Hay más de un registro para el campo {{column}}.'
|
|
37
|
+
},
|
|
38
|
+
connection_failed: {
|
|
39
|
+
ptBR: 'Falha de conexão com o banco de dados',
|
|
40
|
+
es: 'La conexión a la base de datos falló'
|
|
41
|
+
},
|
|
42
|
+
invalid_input_type: {
|
|
43
|
+
ptBR: 'O valor {{value}} está no formato incorreto',
|
|
44
|
+
es: 'El valor {{value}} está en el formato incorrecto'
|
|
37
45
|
}
|
|
38
46
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const internalServerErrors = {
|
|
2
|
+
non_reconized_error: {
|
|
3
|
+
ptBR: 'Ocorreu um erro não identificado. Por favor, entre em contato com nosso suporte via e-mail: <a href=\"mailto:{{email}}\">{{email}}</a>.',
|
|
4
|
+
es: 'Ha ocurrido un error no identificado. Póngase en contacto con nuestro soporte por correo electrónico: <a href=\"mailto:{{email}}\">{{email}}</a>.'
|
|
5
|
+
},
|
|
6
|
+
non_reconized_error_for_admin: {
|
|
7
|
+
ptBR: 'Ocorreu o seguinte erro: {{error}}<br>Favor contatar o desenvolvimento.',
|
|
8
|
+
es: 'Se produjo el siguiente error: {{error}}<br>Póngase en contacto con el desarrollador.'
|
|
9
|
+
}
|
|
10
|
+
};
|
|
@@ -25,6 +25,10 @@ export const joi: ITranslation = {
|
|
|
25
25
|
ptBR: '{{label}} precisa ter no mínimo {{limit}}.',
|
|
26
26
|
es: '{{label}} debe tener al menos {{limit}}.'
|
|
27
27
|
},
|
|
28
|
+
'number.max': {
|
|
29
|
+
ptBR: '{{label}} precisa ter no máximo {{limit}}.',
|
|
30
|
+
es: '{{label}} debe tener al máximo {{limit}}.'
|
|
31
|
+
},
|
|
28
32
|
'number.integer': {
|
|
29
33
|
ptBR: '{{label}} precisa ser um número inteiro.',
|
|
30
34
|
es: '{{label}} debe ser un entero.'
|
|
@@ -91,6 +91,7 @@ import * as warehouse_item from './modules/warehouse_item';
|
|
|
91
91
|
|
|
92
92
|
export { joi } from './common/joi';
|
|
93
93
|
export { databaseErrors } from './common/database-errors';
|
|
94
|
+
export { internalServerErrors } from './common/internal-server-errors';
|
|
94
95
|
|
|
95
96
|
export {
|
|
96
97
|
auth,
|