@sofit/view-locale 1.92.0 → 1.93.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.
@@ -1,22 +1,22 @@
1
- <testsuites name="Sofit view locale tests" tests="8" failures="0" time="3.115">
2
- <testsuite name="Joi tests" errors="0" failures="0" skipped="0" timestamp="2020-04-30T13:43:08" time="2.332" tests="4">
3
- <testcase classname="Joi tests should return default message" name="Joi tests should return default message" time="0.003">
1
+ <testsuites name="Sofit view locale tests" tests="8" failures="0" time="2.538">
2
+ <testsuite name="Vehicle locale test" errors="0" failures="0" skipped="0" timestamp="2020-05-15T19:49:31" time="1.838" tests="4">
3
+ <testcase classname="Vehicle locale test Should get translations with reach" name="Vehicle locale test Should get translations with reach" time="0.004">
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="Vehicle locale test Should replace correctly with reach" name="Vehicle locale test Should replace correctly with reach" time="0">
6
6
  </testcase>
7
- <testcase classname="Joi tests should return translated label message" name="Joi tests should return translated label message" time="0">
7
+ <testcase classname="Vehicle locale test Should get translations with raw" name="Vehicle locale test Should get translations with raw" time="0.001">
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="Vehicle locale test Should replace correctly with raw" name="Vehicle locale test Should replace correctly with raw" time="0">
10
10
  </testcase>
11
11
  </testsuite>
12
- <testsuite name="Vehicle locale test" errors="0" failures="0" skipped="0" timestamp="2020-04-30T13:43:08" time="2.385" tests="4">
13
- <testcase classname="Vehicle locale test Should get translations with reach" name="Vehicle locale test Should get translations with reach" time="0.003">
12
+ <testsuite name="Joi tests" errors="0" failures="0" skipped="0" timestamp="2020-05-15T19:49:31" time="1.843" tests="4">
13
+ <testcase classname="Joi tests should return default message" name="Joi tests should return default message" 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="Joi tests should return non label message" name="Joi tests should return non label message" 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.001">
17
+ <testcase classname="Joi tests should return translated label message" name="Joi tests should return translated label message" time="0">
18
18
  </testcase>
19
- <testcase classname="Vehicle locale test Should replace correctly with raw" name="Vehicle locale test Should replace correctly with raw" time="0">
19
+ <testcase classname="Joi tests should return translated label index" name="Joi tests should return translated label index" time="0.001">
20
20
  </testcase>
21
21
  </testsuite>
22
22
  </testsuites>
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 !== undefined) {
27
- for (const key in replaces) {
28
- if (replaces.hasOwnProperty(key)) {
29
- const value = replaces[key];
30
- text = text.replace(`{{${key}}}`, value);
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;
@@ -35,4 +35,12 @@ export declare const databaseErrors: {
35
35
  ptBR: string;
36
36
  es: string;
37
37
  };
38
+ connection_failed: {
39
+ ptBR: string;
40
+ es: string;
41
+ };
42
+ invalid_input_type: {
43
+ ptBR: string;
44
+ es: string;
45
+ };
38
46
  };
@@ -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,10 @@
1
+ export declare const internalServerErrors: {
2
+ non_reconized_error: {
3
+ ptBR: string;
4
+ es: string;
5
+ };
6
+ non_reconized_error_for_admin: {
7
+ ptBR: string;
8
+ es: string;
9
+ };
10
+ };
@@ -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
+ };
@@ -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 !== undefined) {
35
+ if (replaces) {
36
36
 
37
- for (const key in replaces) {
37
+ for (const key of Object.keys(replaces)) {
38
38
 
39
- if (replaces.hasOwnProperty(key)) {
39
+ const value = replaces[key];
40
+ const regex = new RegExp(String.raw`{{${key}}}`, 'g');
40
41
 
41
- const value = replaces[key];
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
+ };
@@ -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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sofit/view-locale",
3
- "version": "1.92.0",
3
+ "version": "1.93.0",
4
4
  "description": "Traduções do Sofit View",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",