@sofit/view-locale 0.3.0 → 1.0.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 +11 -11
- package/dist/runner.d.ts +1 -0
- package/dist/runner.js +20 -12
- package/dist/translations/common/entity.d.ts +10 -0
- package/dist/translations/{modules/gate/gate.js → common/entity.js} +5 -1
- package/dist/translations/common/joi.js +10 -6
- package/dist/translations/index.d.ts +4 -2
- package/dist/translations/index.js +13 -4
- package/dist/translations/modules/company.d.ts +66 -0
- package/dist/translations/modules/company.js +46 -0
- package/dist/translations/modules/gate.d.ts +10 -0
- package/dist/translations/modules/gate.js +4 -0
- package/dist/translations/modules/warehouse.d.ts +24 -0
- package/dist/translations/modules/warehouse.js +16 -0
- package/lib/runner.ts +26 -13
- package/lib/tests/basic.spec.ts +4 -4
- package/lib/tests/joi.spec.ts +10 -8
- package/lib/translations/common/entity.ts +10 -0
- package/lib/translations/common/joi.ts +10 -6
- package/lib/translations/index.ts +11 -3
- package/lib/translations/modules/company.ts +61 -0
- package/lib/translations/modules/gate.ts +5 -0
- package/lib/translations/modules/warehouse.ts +20 -0
- package/package.json +1 -1
- package/dist/translations/common/buttons.d.ts +0 -2
- package/dist/translations/common/buttons.js +0 -8
- package/dist/translations/modules/gate/gate.d.ts +0 -2
- package/lib/translations/common/buttons.ts +0 -8
- package/lib/translations/modules/gate/gate.ts +0 -8
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
<testsuites name="Sofit view locale tests" tests="8" failures="0" time="
|
|
2
|
-
<testsuite name="
|
|
3
|
-
<testcase classname="
|
|
1
|
+
<testsuites name="Sofit view locale tests" tests="8" failures="0" time="3.482">
|
|
2
|
+
<testsuite name="Vehicle locale test" errors="0" failures="0" skipped="0" timestamp="2018-08-21T11:21:30" time="1.962" tests="4">
|
|
3
|
+
<testcase classname="Vehicle locale test Should get translations with reach" name="Vehicle locale test Should get translations with reach" time="0.011">
|
|
4
4
|
</testcase>
|
|
5
|
-
<testcase classname="
|
|
5
|
+
<testcase classname="Vehicle locale test Should replace correctly with reach" name="Vehicle locale test Should replace correctly with reach" time="0.001">
|
|
6
6
|
</testcase>
|
|
7
|
-
<testcase classname="
|
|
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="
|
|
9
|
+
<testcase classname="Vehicle locale test Should replace correctly with raw" name="Vehicle locale test Should replace correctly with raw" time="0.001">
|
|
10
10
|
</testcase>
|
|
11
11
|
</testsuite>
|
|
12
|
-
<testsuite name="
|
|
13
|
-
<testcase classname="
|
|
12
|
+
<testsuite name="Joi tests" errors="0" failures="0" skipped="0" timestamp="2018-08-21T11:21:30" time="1.998" tests="4">
|
|
13
|
+
<testcase classname="Joi tests should return default message" name="Joi tests should return default message" time="0.01">
|
|
14
14
|
</testcase>
|
|
15
|
-
<testcase classname="
|
|
15
|
+
<testcase classname="Joi tests should return non label message" name="Joi tests should return non label message" time="0.002">
|
|
16
16
|
</testcase>
|
|
17
|
-
<testcase classname="
|
|
17
|
+
<testcase classname="Joi tests should return translated label message" name="Joi tests should return translated label message" time="0.001">
|
|
18
18
|
</testcase>
|
|
19
|
-
<testcase classname="
|
|
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.d.ts
CHANGED
package/dist/runner.js
CHANGED
|
@@ -8,6 +8,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
8
8
|
};
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
const TRANSLATIONS = __importStar(require("./translations"));
|
|
11
|
+
const TRANSLATION_NOT_FOUND = 'Translation not found';
|
|
11
12
|
class Locale {
|
|
12
13
|
constructor(language) {
|
|
13
14
|
switch (language) {
|
|
@@ -32,7 +33,7 @@ class Locale {
|
|
|
32
33
|
}
|
|
33
34
|
return text;
|
|
34
35
|
}
|
|
35
|
-
return
|
|
36
|
+
return TRANSLATION_NOT_FOUND;
|
|
36
37
|
}
|
|
37
38
|
raw(path, replaces) {
|
|
38
39
|
const paths = path.split('.');
|
|
@@ -47,24 +48,31 @@ class Locale {
|
|
|
47
48
|
if (target) {
|
|
48
49
|
return this.reach(target, replaces);
|
|
49
50
|
}
|
|
50
|
-
return
|
|
51
|
+
return TRANSLATION_NOT_FOUND;
|
|
51
52
|
}
|
|
52
53
|
joi(detail) {
|
|
53
54
|
const accessKey = TRANSLATIONS.joi[detail.type];
|
|
54
55
|
if (accessKey) {
|
|
55
|
-
|
|
56
|
-
if (typeof detail.context.label === 'number') {
|
|
57
|
-
detail.context.label = this.reach(TRANSLATIONS.joi.index, {
|
|
58
|
-
index: (detail.context.label + 1).toString()
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
detail.context.label = this.raw(detail.context.label);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
56
|
+
this.setJoiLabel(detail);
|
|
65
57
|
return this.reach(TRANSLATIONS.joi[detail.type], detail.context);
|
|
66
58
|
}
|
|
67
59
|
return `There is no translation for joi type '${detail.type}'`;
|
|
68
60
|
}
|
|
61
|
+
setJoiLabel(detail) {
|
|
62
|
+
if (detail.context && (!(detail.context.key || '').startsWith('cf_'))) {
|
|
63
|
+
if (typeof detail.context.label === 'number') {
|
|
64
|
+
detail.context.label = this.reach(TRANSLATIONS.joi.index, {
|
|
65
|
+
index: (detail.context.label + 1).toString(),
|
|
66
|
+
path: detail.path[0]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
detail.context.label = this.raw(detail.context.label);
|
|
71
|
+
}
|
|
72
|
+
if (detail.context.label === TRANSLATION_NOT_FOUND) {
|
|
73
|
+
detail.context.label = detail.context.key;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
69
77
|
}
|
|
70
78
|
exports.Locale = Locale;
|
|
@@ -2,16 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.joi = {
|
|
4
4
|
'index': {
|
|
5
|
-
ptBR: '{{index}}º valor',
|
|
6
|
-
es: '{{index}}er valor'
|
|
5
|
+
ptBR: '{{index}}º valor de {{path}}',
|
|
6
|
+
es: '{{index}}er valor de {{path}}'
|
|
7
7
|
},
|
|
8
8
|
'string.base': {
|
|
9
|
-
ptBR: '{{label}} precisa ser
|
|
10
|
-
es: '{{label}} debe se
|
|
9
|
+
ptBR: '{{label}} precisa ser do tipo texto.',
|
|
10
|
+
es: '{{label}} debe se del tipo texto.'
|
|
11
|
+
},
|
|
12
|
+
'string.email': {
|
|
13
|
+
ptBR: '{{label}} precisa ser um email válido.',
|
|
14
|
+
es: '{{label}}'
|
|
11
15
|
},
|
|
12
16
|
'number.base': {
|
|
13
|
-
ptBR: '{{label}} precisa ser numérico.',
|
|
14
|
-
es: '{{label}} debe ser numérico.'
|
|
17
|
+
ptBR: '{{label}} precisa ser do tipo numérico.',
|
|
18
|
+
es: '{{label}} debe ser del tipo numérico.'
|
|
15
19
|
},
|
|
16
20
|
'number.min': {
|
|
17
21
|
ptBR: '{{label}} precisa ter no mínimo {{limit}}.',
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as company from './modules/company';
|
|
2
|
+
import * as gate from './modules/gate';
|
|
3
|
+
import * as warehouse from './modules/warehouse';
|
|
3
4
|
export { joi } from './common/joi';
|
|
4
5
|
export { databaseErrors } from './common/database-errors';
|
|
6
|
+
export { gate, company, warehouse };
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
3
|
+
if (mod && mod.__esModule) return mod;
|
|
4
|
+
var result = {};
|
|
5
|
+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
6
|
+
result["default"] = mod;
|
|
7
|
+
return result;
|
|
8
|
+
};
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
exports.
|
|
5
|
-
|
|
6
|
-
exports.
|
|
10
|
+
const company = __importStar(require("./modules/company"));
|
|
11
|
+
exports.company = company;
|
|
12
|
+
const gate = __importStar(require("./modules/gate"));
|
|
13
|
+
exports.gate = gate;
|
|
14
|
+
const warehouse = __importStar(require("./modules/warehouse"));
|
|
15
|
+
exports.warehouse = warehouse;
|
|
7
16
|
var joi_1 = require("./common/joi");
|
|
8
17
|
exports.joi = joi_1.joi;
|
|
9
18
|
var database_errors_1 = require("./common/database-errors");
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
export declare const fields: {
|
|
2
|
+
cnpj: {
|
|
3
|
+
ptBR: string;
|
|
4
|
+
es: string;
|
|
5
|
+
};
|
|
6
|
+
address: {
|
|
7
|
+
ptBR: string;
|
|
8
|
+
es: string;
|
|
9
|
+
};
|
|
10
|
+
address_num: {
|
|
11
|
+
ptBR: string;
|
|
12
|
+
es: string;
|
|
13
|
+
};
|
|
14
|
+
address_neighborhood: {
|
|
15
|
+
ptBR: string;
|
|
16
|
+
es: string;
|
|
17
|
+
};
|
|
18
|
+
address_state_id: {
|
|
19
|
+
ptBR: string;
|
|
20
|
+
es: string;
|
|
21
|
+
};
|
|
22
|
+
address_city_id: {
|
|
23
|
+
ptBR: string;
|
|
24
|
+
es: string;
|
|
25
|
+
};
|
|
26
|
+
address_complementary: {
|
|
27
|
+
ptBR: string;
|
|
28
|
+
es: string;
|
|
29
|
+
};
|
|
30
|
+
postal_code: {
|
|
31
|
+
ptBR: string;
|
|
32
|
+
es: string;
|
|
33
|
+
};
|
|
34
|
+
responsible: {
|
|
35
|
+
ptBR: string;
|
|
36
|
+
es: string;
|
|
37
|
+
};
|
|
38
|
+
cnae: {
|
|
39
|
+
ptBR: string;
|
|
40
|
+
es: string;
|
|
41
|
+
};
|
|
42
|
+
cnae_description: {
|
|
43
|
+
ptBR: string;
|
|
44
|
+
es: string;
|
|
45
|
+
};
|
|
46
|
+
secondary_cnae: {
|
|
47
|
+
ptBR: string;
|
|
48
|
+
es: string;
|
|
49
|
+
};
|
|
50
|
+
alert_emails: {
|
|
51
|
+
ptBR: string;
|
|
52
|
+
es: string;
|
|
53
|
+
};
|
|
54
|
+
alert_users: {
|
|
55
|
+
ptBR: string;
|
|
56
|
+
es: string;
|
|
57
|
+
};
|
|
58
|
+
name: {
|
|
59
|
+
ptBR: string;
|
|
60
|
+
es: string;
|
|
61
|
+
};
|
|
62
|
+
external_id: {
|
|
63
|
+
ptBR: string;
|
|
64
|
+
es: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const entity_1 = require("../common/entity");
|
|
4
|
+
exports.fields = Object.assign({}, entity_1.ENTITY_COMMON, { cnpj: {
|
|
5
|
+
ptBR: 'CNPJ/CPF',
|
|
6
|
+
es: 'CNPJ/CPF'
|
|
7
|
+
}, address: {
|
|
8
|
+
ptBR: 'Endereço',
|
|
9
|
+
es: 'Dirección'
|
|
10
|
+
}, address_num: {
|
|
11
|
+
ptBR: 'Nº',
|
|
12
|
+
es: 'Nº'
|
|
13
|
+
}, address_neighborhood: {
|
|
14
|
+
ptBR: 'Bairro',
|
|
15
|
+
es: 'Bario'
|
|
16
|
+
}, address_state_id: {
|
|
17
|
+
ptBR: 'UF',
|
|
18
|
+
es: 'Provincia'
|
|
19
|
+
}, address_city_id: {
|
|
20
|
+
ptBR: 'Cidade',
|
|
21
|
+
es: 'Ciudad'
|
|
22
|
+
}, address_complementary: {
|
|
23
|
+
ptBR: 'Complemento',
|
|
24
|
+
es: 'Complemento'
|
|
25
|
+
}, postal_code: {
|
|
26
|
+
ptBR: 'CEP',
|
|
27
|
+
es: 'Codico postal'
|
|
28
|
+
}, responsible: {
|
|
29
|
+
ptBR: 'Responsável',
|
|
30
|
+
es: 'Responsable'
|
|
31
|
+
}, cnae: {
|
|
32
|
+
ptBR: 'CNAE',
|
|
33
|
+
es: 'CNAE'
|
|
34
|
+
}, cnae_description: {
|
|
35
|
+
ptBR: 'Descrição do CNAE',
|
|
36
|
+
es: 'Descrición del CNAE'
|
|
37
|
+
}, secondary_cnae: {
|
|
38
|
+
ptBR: 'CNAE Secundário',
|
|
39
|
+
es: 'CNAE Segundario'
|
|
40
|
+
}, alert_emails: {
|
|
41
|
+
ptBR: 'Emails para recebimento de alerta',
|
|
42
|
+
es: 'Emails para recebimiento de alerta'
|
|
43
|
+
}, alert_users: {
|
|
44
|
+
ptBR: 'Usuários para recebimento de alertas',
|
|
45
|
+
es: 'Usuarios para recebimento de alertas'
|
|
46
|
+
} });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export declare const fields: {
|
|
2
|
+
subsidiary_id: {
|
|
3
|
+
ptBR: string;
|
|
4
|
+
es: string;
|
|
5
|
+
};
|
|
6
|
+
active: {
|
|
7
|
+
ptBR: string;
|
|
8
|
+
es: string;
|
|
9
|
+
};
|
|
10
|
+
name: {
|
|
11
|
+
ptBR: string;
|
|
12
|
+
es: string;
|
|
13
|
+
};
|
|
14
|
+
external_id: {
|
|
15
|
+
ptBR: string;
|
|
16
|
+
es: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const messages: {
|
|
20
|
+
cant_be_disabled: {
|
|
21
|
+
ptBR: string;
|
|
22
|
+
es: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const entity_1 = require("../common/entity");
|
|
4
|
+
exports.fields = Object.assign({}, entity_1.ENTITY_COMMON, { subsidiary_id: {
|
|
5
|
+
ptBR: 'Filial',
|
|
6
|
+
es: 'Filial'
|
|
7
|
+
}, active: {
|
|
8
|
+
ptBR: 'Ativo',
|
|
9
|
+
es: 'Activo'
|
|
10
|
+
} });
|
|
11
|
+
exports.messages = {
|
|
12
|
+
cant_be_disabled: {
|
|
13
|
+
ptBR: 'O depósito ainda contém itens e não pode ser desativado!',
|
|
14
|
+
es: 'El depósito todavía contiene elementos y no se puede deshabilitar!'
|
|
15
|
+
}
|
|
16
|
+
};
|
package/lib/runner.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { IValidationErrorItem } from './joi/joi.interface';
|
|
|
2
2
|
import { IAccessKey, LANGUAGES } from './languages';
|
|
3
3
|
import * as TRANSLATIONS from './translations';
|
|
4
4
|
|
|
5
|
+
const TRANSLATION_NOT_FOUND = 'Translation not found';
|
|
6
|
+
|
|
5
7
|
export interface IReplaces {
|
|
6
8
|
[key: string]: string;
|
|
7
9
|
}
|
|
@@ -46,7 +48,7 @@ export class Locale {
|
|
|
46
48
|
return text;
|
|
47
49
|
}
|
|
48
50
|
|
|
49
|
-
return
|
|
51
|
+
return TRANSLATION_NOT_FOUND;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
public raw(path: string, replaces?: IReplaces): string {
|
|
@@ -71,7 +73,7 @@ export class Locale {
|
|
|
71
73
|
return this.reach(target, replaces);
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
return
|
|
76
|
+
return TRANSLATION_NOT_FOUND;
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
public joi(detail: IValidationErrorItem) {
|
|
@@ -80,22 +82,33 @@ export class Locale {
|
|
|
80
82
|
|
|
81
83
|
if (accessKey) {
|
|
82
84
|
|
|
83
|
-
|
|
85
|
+
this.setJoiLabel(detail);
|
|
86
|
+
|
|
87
|
+
return this.reach(TRANSLATIONS.joi[detail.type], detail.context as IReplaces);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return `There is no translation for joi type '${detail.type}'`;
|
|
91
|
+
}
|
|
84
92
|
|
|
85
|
-
|
|
93
|
+
private setJoiLabel(detail: IValidationErrorItem) {
|
|
86
94
|
|
|
87
|
-
|
|
88
|
-
index: (detail.context.label as number + 1).toString()
|
|
89
|
-
});
|
|
90
|
-
} else {
|
|
95
|
+
if (detail.context && (!(detail.context.key || '').startsWith('cf_'))) {
|
|
91
96
|
|
|
92
|
-
|
|
93
|
-
|
|
97
|
+
if (typeof detail.context.label === 'number') {
|
|
98
|
+
|
|
99
|
+
detail.context.label = this.reach(TRANSLATIONS.joi.index, {
|
|
100
|
+
index: (detail.context.label as number + 1).toString(),
|
|
101
|
+
path: detail.path[0]
|
|
102
|
+
});
|
|
103
|
+
} else {
|
|
104
|
+
|
|
105
|
+
detail.context.label = this.raw(detail.context.label as string);
|
|
94
106
|
}
|
|
95
107
|
|
|
96
|
-
|
|
97
|
-
}
|
|
108
|
+
if (detail.context.label === TRANSLATION_NOT_FOUND) {
|
|
98
109
|
|
|
99
|
-
|
|
110
|
+
detail.context.label = detail.context.key;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
100
113
|
}
|
|
101
114
|
}
|
package/lib/tests/basic.spec.ts
CHANGED
|
@@ -7,10 +7,10 @@ describe('Vehicle locale test', () => {
|
|
|
7
7
|
|
|
8
8
|
it('Should get translations with reach', () => {
|
|
9
9
|
|
|
10
|
-
expect(localeptBR.reach(i18n.gate.name))
|
|
11
|
-
.toEqual(i18n.gate.name.ptBR);
|
|
12
|
-
expect(localeES.reach(i18n.gate.name))
|
|
13
|
-
.toEqual(i18n.gate.name.es);
|
|
10
|
+
expect(localeptBR.reach(i18n.gate.fields.name))
|
|
11
|
+
.toEqual(i18n.gate.fields.name.ptBR);
|
|
12
|
+
expect(localeES.reach(i18n.gate.fields.name))
|
|
13
|
+
.toEqual(i18n.gate.fields.name.es);
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
it('Should replace correctly with reach', () => {
|
package/lib/tests/joi.spec.ts
CHANGED
|
@@ -25,14 +25,14 @@ describe('Joi tests', () => {
|
|
|
25
25
|
key: 'cf_1',
|
|
26
26
|
label: 'mararaia'
|
|
27
27
|
}
|
|
28
|
-
} as any)).toEqual('mararaia precisa ser
|
|
28
|
+
} as any)).toEqual('mararaia precisa ser do tipo texto.');
|
|
29
29
|
expect(localeptES.joi({
|
|
30
30
|
type: 'string.base',
|
|
31
31
|
context: {
|
|
32
32
|
key: 'cf_1',
|
|
33
33
|
label: 'mararaia'
|
|
34
34
|
}
|
|
35
|
-
} as any)).toEqual('mararaia debe se
|
|
35
|
+
} as any)).toEqual('mararaia debe se del tipo texto.');
|
|
36
36
|
});
|
|
37
37
|
|
|
38
38
|
it('should return translated label message', () => {
|
|
@@ -41,33 +41,35 @@ describe('Joi tests', () => {
|
|
|
41
41
|
type: 'string.base',
|
|
42
42
|
context: {
|
|
43
43
|
key: 'otra',
|
|
44
|
-
label: 'gate.name'
|
|
44
|
+
label: 'gate.fields.name'
|
|
45
45
|
}
|
|
46
|
-
} as any)).toEqual('Nome precisa ser
|
|
46
|
+
} as any)).toEqual('Nome precisa ser do tipo texto.');
|
|
47
47
|
expect(localeptES.joi({
|
|
48
48
|
type: 'string.base',
|
|
49
49
|
context: {
|
|
50
50
|
key: 'otra',
|
|
51
|
-
label: 'gate.name'
|
|
51
|
+
label: 'gate.fields.name'
|
|
52
52
|
}
|
|
53
|
-
} as any)).toEqual('Nombre debe se
|
|
53
|
+
} as any)).toEqual('Nombre debe se del tipo texto.');
|
|
54
54
|
});
|
|
55
55
|
|
|
56
56
|
it('should return translated label index', () => {
|
|
57
57
|
|
|
58
58
|
expect(localeptBR.joi({
|
|
59
59
|
type: 'string.base',
|
|
60
|
+
path: ['path'],
|
|
60
61
|
context: {
|
|
61
62
|
key: 0,
|
|
62
63
|
label: 0
|
|
63
64
|
}
|
|
64
|
-
} as any)).toEqual('1º valor precisa ser
|
|
65
|
+
} as any)).toEqual('1º valor de path precisa ser do tipo texto.');
|
|
65
66
|
expect(localeptES.joi({
|
|
66
67
|
type: 'string.base',
|
|
68
|
+
path: ['path'],
|
|
67
69
|
context: {
|
|
68
70
|
key: 0,
|
|
69
71
|
label: 0
|
|
70
72
|
}
|
|
71
|
-
} as any)).toEqual('1er valor debe se
|
|
73
|
+
} as any)).toEqual('1er valor de path debe se del tipo texto.');
|
|
72
74
|
});
|
|
73
75
|
});
|
|
@@ -2,16 +2,20 @@ import { ITranslation } from '../translation.interface';
|
|
|
2
2
|
|
|
3
3
|
export const joi: ITranslation = {
|
|
4
4
|
'index': {
|
|
5
|
-
ptBR: '{{index}}º valor',
|
|
6
|
-
es: '{{index}}er valor'
|
|
5
|
+
ptBR: '{{index}}º valor de {{path}}',
|
|
6
|
+
es: '{{index}}er valor de {{path}}'
|
|
7
7
|
},
|
|
8
8
|
'string.base': {
|
|
9
|
-
ptBR: '{{label}} precisa ser
|
|
10
|
-
es: '{{label}} debe se
|
|
9
|
+
ptBR: '{{label}} precisa ser do tipo texto.',
|
|
10
|
+
es: '{{label}} debe se del tipo texto.'
|
|
11
|
+
},
|
|
12
|
+
'string.email': {
|
|
13
|
+
ptBR: '{{label}} precisa ser um email válido.',
|
|
14
|
+
es: '{{label}}'
|
|
11
15
|
},
|
|
12
16
|
'number.base': {
|
|
13
|
-
ptBR: '{{label}} precisa ser numérico.',
|
|
14
|
-
es: '{{label}} debe ser numérico.'
|
|
17
|
+
ptBR: '{{label}} precisa ser do tipo numérico.',
|
|
18
|
+
es: '{{label}} debe ser del tipo numérico.'
|
|
15
19
|
},
|
|
16
20
|
'number.min': {
|
|
17
21
|
ptBR: '{{label}} precisa ter no mínimo {{limit}}.',
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import * as company from './modules/company';
|
|
2
|
+
import * as gate from './modules/gate';
|
|
3
|
+
import * as warehouse from './modules/warehouse';
|
|
4
|
+
|
|
3
5
|
export { joi } from './common/joi';
|
|
4
|
-
export { databaseErrors } from './common/database-errors';
|
|
6
|
+
export { databaseErrors } from './common/database-errors';
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
gate,
|
|
10
|
+
company,
|
|
11
|
+
warehouse
|
|
12
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { ENTITY_COMMON } from '../common/entity';
|
|
2
|
+
|
|
3
|
+
export const fields = {
|
|
4
|
+
...ENTITY_COMMON,
|
|
5
|
+
cnpj: {
|
|
6
|
+
ptBR: 'CNPJ/CPF',
|
|
7
|
+
es: 'CNPJ/CPF'
|
|
8
|
+
},
|
|
9
|
+
address: {
|
|
10
|
+
ptBR: 'Endereço',
|
|
11
|
+
es: 'Dirección'
|
|
12
|
+
},
|
|
13
|
+
address_num: {
|
|
14
|
+
ptBR: 'Nº',
|
|
15
|
+
es: 'Nº'
|
|
16
|
+
},
|
|
17
|
+
address_neighborhood: {
|
|
18
|
+
ptBR: 'Bairro',
|
|
19
|
+
es: 'Bario'
|
|
20
|
+
},
|
|
21
|
+
address_state_id: {
|
|
22
|
+
ptBR: 'UF',
|
|
23
|
+
es: 'Provincia'
|
|
24
|
+
},
|
|
25
|
+
address_city_id: {
|
|
26
|
+
ptBR: 'Cidade',
|
|
27
|
+
es: 'Ciudad'
|
|
28
|
+
},
|
|
29
|
+
address_complementary: {
|
|
30
|
+
ptBR: 'Complemento',
|
|
31
|
+
es: 'Complemento'
|
|
32
|
+
},
|
|
33
|
+
postal_code: {
|
|
34
|
+
ptBR: 'CEP',
|
|
35
|
+
es: 'Codico postal'
|
|
36
|
+
},
|
|
37
|
+
responsible: {
|
|
38
|
+
ptBR: 'Responsável',
|
|
39
|
+
es: 'Responsable'
|
|
40
|
+
},
|
|
41
|
+
cnae: {
|
|
42
|
+
ptBR: 'CNAE',
|
|
43
|
+
es: 'CNAE'
|
|
44
|
+
},
|
|
45
|
+
cnae_description: {
|
|
46
|
+
ptBR: 'Descrição do CNAE',
|
|
47
|
+
es: 'Descrición del CNAE'
|
|
48
|
+
},
|
|
49
|
+
secondary_cnae: {
|
|
50
|
+
ptBR: 'CNAE Secundário',
|
|
51
|
+
es: 'CNAE Segundario'
|
|
52
|
+
},
|
|
53
|
+
alert_emails: {
|
|
54
|
+
ptBR: 'Emails para recebimento de alerta',
|
|
55
|
+
es: 'Emails para recebimiento de alerta'
|
|
56
|
+
},
|
|
57
|
+
alert_users: {
|
|
58
|
+
ptBR: 'Usuários para recebimento de alertas',
|
|
59
|
+
es: 'Usuarios para recebimento de alertas'
|
|
60
|
+
}
|
|
61
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ENTITY_COMMON } from '../common/entity';
|
|
2
|
+
|
|
3
|
+
export const fields = {
|
|
4
|
+
...ENTITY_COMMON,
|
|
5
|
+
subsidiary_id: {
|
|
6
|
+
ptBR: 'Filial',
|
|
7
|
+
es: 'Filial'
|
|
8
|
+
},
|
|
9
|
+
active: {
|
|
10
|
+
ptBR: 'Ativo',
|
|
11
|
+
es: 'Activo'
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const messages = {
|
|
16
|
+
cant_be_disabled: {
|
|
17
|
+
ptBR: 'O depósito ainda contém itens e não pode ser desativado!',
|
|
18
|
+
es: 'El depósito todavía contiene elementos y no se puede deshabilitar!'
|
|
19
|
+
}
|
|
20
|
+
};
|
package/package.json
CHANGED