Skip to content

Commit e4f9ac5

Browse files
committed
add french translation (brutusin#75)
1 parent db38a4e commit e4f9ac5

7 files changed

+168
-115
lines changed

dist/js/brutusin-json-forms-lan-es_ES.min.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

dist/js/brutusin-json-forms.js

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ if (typeof brutusin === "undefined") {
434434
appendChild(container, display, s);
435435

436436
};
437+
437438
renderers["object"] = function (container, id, parentObject, propertyProvider, value) {
438439

439440
function createStaticPropertyProvider(propname) {
@@ -967,7 +968,9 @@ if (typeof brutusin === "undefined") {
967968
}
968969

969970
function renameRequiredPropeties(schema) {
970-
if (schema.hasOwnProperty("oneOf")) {
971+
if (!schema) {
972+
return;
973+
} else if (schema.hasOwnProperty("oneOf")) {
971974
for (var i in schema.oneOf) {
972975
renameRequiredPropeties(schema.oneOf[i]);
973976
}
@@ -1010,7 +1013,9 @@ if (typeof brutusin === "undefined") {
10101013
pseudoSchema["$id"] = name;
10111014
schemaMap[name] = pseudoSchema;
10121015

1013-
if (schema.hasOwnProperty("oneOf")) {
1016+
if (!schema) {
1017+
return;
1018+
} else if (schema.hasOwnProperty("oneOf")) {
10141019
pseudoSchema.oneOf = new Array();
10151020
pseudoSchema.type = "oneOf";
10161021
for (var i in schema.oneOf) {
@@ -1020,21 +1025,22 @@ if (typeof brutusin === "undefined") {
10201025
}
10211026
} else if (schema.hasOwnProperty("$ref")) {
10221027
var refSchema = getDefinition(schema["$ref"]);
1023-
if (schema.hasOwnProperty("title") || schema.hasOwnProperty("description")) {
1024-
var clonedRefSchema = {};
1025-
for (var prop in refSchema) {
1026-
clonedRefSchema[prop] = refSchema[prop];
1027-
}
1028-
if (schema.hasOwnProperty("title")) {
1029-
clonedRefSchema.title = schema.title;
1030-
}
1031-
if (schema.hasOwnProperty("description")) {
1032-
clonedRefSchema.description = schema.description;
1028+
if (refSchema) {
1029+
if (schema.hasOwnProperty("title") || schema.hasOwnProperty("description")) {
1030+
var clonedRefSchema = {};
1031+
for (var prop in refSchema) {
1032+
clonedRefSchema[prop] = refSchema[prop];
1033+
}
1034+
if (schema.hasOwnProperty("title")) {
1035+
clonedRefSchema.title = schema.title;
1036+
}
1037+
if (schema.hasOwnProperty("description")) {
1038+
clonedRefSchema.description = schema.description;
1039+
}
1040+
refSchema = clonedRefSchema;
10331041
}
1034-
refSchema = clonedRefSchema;
1042+
populateSchemaMap(name, refSchema);
10351043
}
1036-
populateSchemaMap(name, refSchema);
1037-
10381044
} else if (schema.type === "object") {
10391045
if (schema.properties) {
10401046
pseudoSchema.properties = new Object();
@@ -1195,6 +1201,25 @@ if (typeof brutusin === "undefined") {
11951201
}
11961202
}
11971203
r(container, id, parentObject, propertyProvider, value);
1204+
} else if (s.$ref) {
1205+
if (obj.schemaResolver) {
1206+
var cb = function (schemas) {
1207+
if (schemas && schemas.hasOwnProperty(id)) {
1208+
if (JSON.stringify(schemaMap[id]) !== JSON.stringify(schemas[id])) {
1209+
cleanSchemaMap(id);
1210+
cleanData(id);
1211+
populateSchemaMap(id, schemas[id]);
1212+
var renderInfo = renderInfoMap[id];
1213+
if (renderInfo) {
1214+
render(renderInfo.titleContainer, renderInfo.container, id, renderInfo.parentObject, renderInfo.propertyProvider, renderInfo.value);
1215+
}
1216+
}
1217+
}
1218+
BrutusinForms.onResolutionFinished(parentObject);
1219+
};
1220+
BrutusinForms.onResolutionStarted(parentObject);
1221+
obj.schemaResolver([id], obj.getData(), cb);
1222+
}
11981223
}
11991224
}
12001225

@@ -1279,20 +1304,22 @@ if (typeof brutusin === "undefined") {
12791304
return schemaMap[schemaId];
12801305
}
12811306

1282-
function onDependencyChanged(name, source) {
1283-
function cleanSchemaMap(schemaId) {
1284-
for (var prop in schemaMap) {
1285-
if (schemaId.startsWith(prop)) {
1286-
delete schemaMap[prop];
1287-
}
1307+
function cleanSchemaMap(schemaId) {
1308+
for (var prop in schemaMap) {
1309+
if (schemaId.startsWith(prop)) {
1310+
delete schemaMap[prop];
12881311
}
12891312
}
1290-
function cleanData(schemaId) {
1291-
var expression = new Expression(schemaId);
1292-
expression.visit(data, function (data, parent, property) {
1293-
delete parent[property];
1294-
});
1295-
}
1313+
}
1314+
function cleanData(schemaId) {
1315+
var expression = new Expression(schemaId);
1316+
expression.visit(data, function (data, parent, property) {
1317+
delete parent[property];
1318+
});
1319+
}
1320+
1321+
function onDependencyChanged(name, source) {
1322+
12961323
var arr = dependencyMap[name];
12971324
if (!arr || !obj.schemaResolver) {
12981325
return;

dist/js/brutusin-json-forms.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
if ("undefined" === typeof brutusin || "undefined" === typeof brutusin["json-forms"]) {
2-
throw new Error("brutusin-json-forms-bootstrap.js requires brutusin-json-forms.js");
3-
}
4-
(function () {
5-
var BrutusinForms = brutusin["json-forms"];
6-
7-
BrutusinForms.messages = {
8-
"validationError": "Error de validación",
9-
"required": "Este campo es **obligatorio**",
10-
"invalidValue": "Valor inválido",
11-
"addpropNameExistent": "Esta propiedad ya existe en el objeto",
12-
"addpropNameRequired": "Un nombre es obligatorio",
13-
"minItems": "Se requiere un mínimo de `{0}` elementos",
14-
"maxItems": "Se admiten a lo sumo `{0}` elementos",
15-
"pattern": "El valor no cumple el patrón: `{0}`",
16-
"minLength": "El valor debe tener **como mínimo** `{0}` caracteres de longitud",
17-
"maxLength": "El valor debe tener **como máximo** `{0}` caracteres de longitud",
18-
"multipleOf": "El valor debe ser **múltiplo de** `{0}`",
19-
"minimum": "El valor debe ser **mayor o igual que** `{0}`",
20-
"exclusiveMinimum": "El valor debe ser **mayor que** `{0}`",
21-
"maximum": "El valor debe ser **menor o igual que** `{0}`",
22-
"exclusiveMaximum": "El valor debe ser **menor que** `{0}`",
23-
"minProperties": "Se requieren como mínimo `{0}` propiedades",
24-
"maxProperties": "Se admiten a lo sumo `{0}` propiedades",
25-
"uniqueItems": "Los elementos del array deben ser diferentes",
26-
"addItem": "Añadir elemento",
27-
"true": "Verdadero",
28-
"false": "Falso"
29-
};
1+
if ("undefined" === typeof brutusin || "undefined" === typeof brutusin["json-forms"]) {
2+
throw new Error("brutusin-json-forms-bootstrap.js requires brutusin-json-forms.js");
3+
}
4+
(function () {
5+
var BrutusinForms = brutusin["json-forms"];
6+
7+
BrutusinForms.messages = {
8+
"validationError": "Error de validación",
9+
"required": "Este campo es **obligatorio**",
10+
"invalidValue": "Valor inválido",
11+
"addpropNameExistent": "Esta propiedad ya existe en el objeto",
12+
"addpropNameRequired": "Un nombre es obligatorio",
13+
"minItems": "Se requiere un mínimo de `{0}` elementos",
14+
"maxItems": "Se admiten a lo sumo `{0}` elementos",
15+
"pattern": "El valor no cumple el patrón: `{0}`",
16+
"minLength": "El valor debe tener **como mínimo** `{0}` caracteres de longitud",
17+
"maxLength": "El valor debe tener **como máximo** `{0}` caracteres de longitud",
18+
"multipleOf": "El valor debe ser **múltiplo de** `{0}`",
19+
"minimum": "El valor debe ser **mayor o igual que** `{0}`",
20+
"exclusiveMinimum": "El valor debe ser **mayor que** `{0}`",
21+
"maximum": "El valor debe ser **menor o igual que** `{0}`",
22+
"exclusiveMaximum": "El valor debe ser **menor que** `{0}`",
23+
"minProperties": "Se requieren como mínimo `{0}` propiedades",
24+
"maxProperties": "Se admiten a lo sumo `{0}` propiedades",
25+
"uniqueItems": "Los elementos del array deben ser diferentes",
26+
"addItem": "Añadir elemento",
27+
"true": "Verdadero",
28+
"false": "Falso"
29+
};
3030
}());
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
if ("undefined" === typeof brutusin || "undefined" === typeof brutusin["json-forms"]) {
2+
throw new Error("brutusin-json-forms-bootstrap.js requires brutusin-json-forms.js");
3+
}
4+
(function () {
5+
var BrutusinForms = brutusin["json-forms"];
6+
7+
BrutusinForms.messages = {
8+
"validationError": "Erreur de validation",
9+
"required": "Ce champ est obligatoire",
10+
"invalidValue": "Valeur du champ invalide",
11+
"addpropNameExistent": "Cet propriété est déjà présente dans l'objet",
12+
"addpropNameRequired": "Un nom est obligatoire",
13+
"minItems": "Au moins {0} éléments sont requis",
14+
"maxItems": "Au plus {0} élément sont autorisés",
15+
"pattern": "La valeur n'est pas conforme au patron: {0}",
16+
"minLength": "La valeur doit être au moins de {0} caractères",
17+
"maxLength": "La valeur doit être *au maximum de {0} caractères",
18+
"multipleOf": "La valeur doit être multiple de {0}",
19+
"minimum": "La valeur doit être supérieur ou égale à {0}",
20+
"exclusiveMinimum": "La valeur doit être supérieur à {0}",
21+
"maximum": "La valeur doit inférieur ou égale à{0}",
22+
"exclusiveMaximum": "La valeur doit être inférieur à {0}",
23+
"minProperties": "Au moins {0} propriétés sont obligatoire",
24+
"maxProperties": "Au plus {0} propriétés sont autorisés",
25+
"uniqueItems": "Les éléments du tableaux doivent être unique",
26+
"addItem": "Ajouter un élément",
27+
"true": "Vrai",
28+
"false": "Faux"
29+
};
30+
}());

src/js/brutusin-json-forms-lan-es_ES.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/js/brutusin-json-forms.js

Lines changed: 54 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,7 @@ if (typeof brutusin === "undefined") {
434434
appendChild(container, display, s);
435435

436436
};
437+
437438
renderers["object"] = function (container, id, parentObject, propertyProvider, value) {
438439

439440
function createStaticPropertyProvider(propname) {
@@ -967,7 +968,9 @@ if (typeof brutusin === "undefined") {
967968
}
968969

969970
function renameRequiredPropeties(schema) {
970-
if (schema.hasOwnProperty("oneOf")) {
971+
if (!schema) {
972+
return;
973+
} else if (schema.hasOwnProperty("oneOf")) {
971974
for (var i in schema.oneOf) {
972975
renameRequiredPropeties(schema.oneOf[i]);
973976
}
@@ -1010,7 +1013,9 @@ if (typeof brutusin === "undefined") {
10101013
pseudoSchema["$id"] = name;
10111014
schemaMap[name] = pseudoSchema;
10121015

1013-
if (schema.hasOwnProperty("oneOf")) {
1016+
if (!schema) {
1017+
return;
1018+
} else if (schema.hasOwnProperty("oneOf")) {
10141019
pseudoSchema.oneOf = new Array();
10151020
pseudoSchema.type = "oneOf";
10161021
for (var i in schema.oneOf) {
@@ -1020,21 +1025,22 @@ if (typeof brutusin === "undefined") {
10201025
}
10211026
} else if (schema.hasOwnProperty("$ref")) {
10221027
var refSchema = getDefinition(schema["$ref"]);
1023-
if (schema.hasOwnProperty("title") || schema.hasOwnProperty("description")) {
1024-
var clonedRefSchema = {};
1025-
for (var prop in refSchema) {
1026-
clonedRefSchema[prop] = refSchema[prop];
1027-
}
1028-
if (schema.hasOwnProperty("title")) {
1029-
clonedRefSchema.title = schema.title;
1030-
}
1031-
if (schema.hasOwnProperty("description")) {
1032-
clonedRefSchema.description = schema.description;
1028+
if (refSchema) {
1029+
if (schema.hasOwnProperty("title") || schema.hasOwnProperty("description")) {
1030+
var clonedRefSchema = {};
1031+
for (var prop in refSchema) {
1032+
clonedRefSchema[prop] = refSchema[prop];
1033+
}
1034+
if (schema.hasOwnProperty("title")) {
1035+
clonedRefSchema.title = schema.title;
1036+
}
1037+
if (schema.hasOwnProperty("description")) {
1038+
clonedRefSchema.description = schema.description;
1039+
}
1040+
refSchema = clonedRefSchema;
10331041
}
1034-
refSchema = clonedRefSchema;
1042+
populateSchemaMap(name, refSchema);
10351043
}
1036-
populateSchemaMap(name, refSchema);
1037-
10381044
} else if (schema.type === "object") {
10391045
if (schema.properties) {
10401046
pseudoSchema.properties = new Object();
@@ -1195,6 +1201,25 @@ if (typeof brutusin === "undefined") {
11951201
}
11961202
}
11971203
r(container, id, parentObject, propertyProvider, value);
1204+
} else if (s.$ref) {
1205+
if (obj.schemaResolver) {
1206+
var cb = function (schemas) {
1207+
if (schemas && schemas.hasOwnProperty(id)) {
1208+
if (JSON.stringify(schemaMap[id]) !== JSON.stringify(schemas[id])) {
1209+
cleanSchemaMap(id);
1210+
cleanData(id);
1211+
populateSchemaMap(id, schemas[id]);
1212+
var renderInfo = renderInfoMap[id];
1213+
if (renderInfo) {
1214+
render(renderInfo.titleContainer, renderInfo.container, id, renderInfo.parentObject, renderInfo.propertyProvider, renderInfo.value);
1215+
}
1216+
}
1217+
}
1218+
BrutusinForms.onResolutionFinished(parentObject);
1219+
};
1220+
BrutusinForms.onResolutionStarted(parentObject);
1221+
obj.schemaResolver([id], obj.getData(), cb);
1222+
}
11981223
}
11991224
}
12001225

@@ -1279,20 +1304,22 @@ if (typeof brutusin === "undefined") {
12791304
return schemaMap[schemaId];
12801305
}
12811306

1282-
function onDependencyChanged(name, source) {
1283-
function cleanSchemaMap(schemaId) {
1284-
for (var prop in schemaMap) {
1285-
if (schemaId.startsWith(prop)) {
1286-
delete schemaMap[prop];
1287-
}
1307+
function cleanSchemaMap(schemaId) {
1308+
for (var prop in schemaMap) {
1309+
if (schemaId.startsWith(prop)) {
1310+
delete schemaMap[prop];
12881311
}
12891312
}
1290-
function cleanData(schemaId) {
1291-
var expression = new Expression(schemaId);
1292-
expression.visit(data, function (data, parent, property) {
1293-
delete parent[property];
1294-
});
1295-
}
1313+
}
1314+
function cleanData(schemaId) {
1315+
var expression = new Expression(schemaId);
1316+
expression.visit(data, function (data, parent, property) {
1317+
delete parent[property];
1318+
});
1319+
}
1320+
1321+
function onDependencyChanged(name, source) {
1322+
12961323
var arr = dependencyMap[name];
12971324
if (!arr || !obj.schemaResolver) {
12981325
return;

0 commit comments

Comments
 (0)