Skip to content

Commit

Permalink
add french translation (brutusin#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
idelvall committed Mar 30, 2017
1 parent db38a4e commit e4f9ac5
Show file tree
Hide file tree
Showing 7 changed files with 168 additions and 115 deletions.
1 change: 0 additions & 1 deletion dist/js/brutusin-json-forms-lan-es_ES.min.js

This file was deleted.

81 changes: 54 additions & 27 deletions dist/js/brutusin-json-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ if (typeof brutusin === "undefined") {
appendChild(container, display, s);

};

renderers["object"] = function (container, id, parentObject, propertyProvider, value) {

function createStaticPropertyProvider(propname) {
Expand Down Expand Up @@ -967,7 +968,9 @@ if (typeof brutusin === "undefined") {
}

function renameRequiredPropeties(schema) {
if (schema.hasOwnProperty("oneOf")) {
if (!schema) {
return;
} else if (schema.hasOwnProperty("oneOf")) {
for (var i in schema.oneOf) {
renameRequiredPropeties(schema.oneOf[i]);
}
Expand Down Expand Up @@ -1010,7 +1013,9 @@ if (typeof brutusin === "undefined") {
pseudoSchema["$id"] = name;
schemaMap[name] = pseudoSchema;

if (schema.hasOwnProperty("oneOf")) {
if (!schema) {
return;
} else if (schema.hasOwnProperty("oneOf")) {
pseudoSchema.oneOf = new Array();
pseudoSchema.type = "oneOf";
for (var i in schema.oneOf) {
Expand All @@ -1020,21 +1025,22 @@ if (typeof brutusin === "undefined") {
}
} else if (schema.hasOwnProperty("$ref")) {
var refSchema = getDefinition(schema["$ref"]);
if (schema.hasOwnProperty("title") || schema.hasOwnProperty("description")) {
var clonedRefSchema = {};
for (var prop in refSchema) {
clonedRefSchema[prop] = refSchema[prop];
}
if (schema.hasOwnProperty("title")) {
clonedRefSchema.title = schema.title;
}
if (schema.hasOwnProperty("description")) {
clonedRefSchema.description = schema.description;
if (refSchema) {
if (schema.hasOwnProperty("title") || schema.hasOwnProperty("description")) {
var clonedRefSchema = {};
for (var prop in refSchema) {
clonedRefSchema[prop] = refSchema[prop];
}
if (schema.hasOwnProperty("title")) {
clonedRefSchema.title = schema.title;
}
if (schema.hasOwnProperty("description")) {
clonedRefSchema.description = schema.description;
}
refSchema = clonedRefSchema;
}
refSchema = clonedRefSchema;
populateSchemaMap(name, refSchema);
}
populateSchemaMap(name, refSchema);

} else if (schema.type === "object") {
if (schema.properties) {
pseudoSchema.properties = new Object();
Expand Down Expand Up @@ -1195,6 +1201,25 @@ if (typeof brutusin === "undefined") {
}
}
r(container, id, parentObject, propertyProvider, value);
} else if (s.$ref) {
if (obj.schemaResolver) {
var cb = function (schemas) {
if (schemas && schemas.hasOwnProperty(id)) {
if (JSON.stringify(schemaMap[id]) !== JSON.stringify(schemas[id])) {
cleanSchemaMap(id);
cleanData(id);
populateSchemaMap(id, schemas[id]);
var renderInfo = renderInfoMap[id];
if (renderInfo) {
render(renderInfo.titleContainer, renderInfo.container, id, renderInfo.parentObject, renderInfo.propertyProvider, renderInfo.value);
}
}
}
BrutusinForms.onResolutionFinished(parentObject);
};
BrutusinForms.onResolutionStarted(parentObject);
obj.schemaResolver([id], obj.getData(), cb);
}
}
}

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

function onDependencyChanged(name, source) {
function cleanSchemaMap(schemaId) {
for (var prop in schemaMap) {
if (schemaId.startsWith(prop)) {
delete schemaMap[prop];
}
function cleanSchemaMap(schemaId) {
for (var prop in schemaMap) {
if (schemaId.startsWith(prop)) {
delete schemaMap[prop];
}
}
function cleanData(schemaId) {
var expression = new Expression(schemaId);
expression.visit(data, function (data, parent, property) {
delete parent[property];
});
}
}
function cleanData(schemaId) {
var expression = new Expression(schemaId);
expression.visit(data, function (data, parent, property) {
delete parent[property];
});
}

function onDependencyChanged(name, source) {

var arr = dependencyMap[name];
if (!arr || !obj.schemaResolver) {
return;
Expand Down
2 changes: 1 addition & 1 deletion dist/js/brutusin-json-forms.min.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
if ("undefined" === typeof brutusin || "undefined" === typeof brutusin["json-forms"]) {
throw new Error("brutusin-json-forms-bootstrap.js requires brutusin-json-forms.js");
}
(function () {
var BrutusinForms = brutusin["json-forms"];

BrutusinForms.messages = {
"validationError": "Error de validación",
"required": "Este campo es **obligatorio**",
"invalidValue": "Valor inválido",
"addpropNameExistent": "Esta propiedad ya existe en el objeto",
"addpropNameRequired": "Un nombre es obligatorio",
"minItems": "Se requiere un mínimo de `{0}` elementos",
"maxItems": "Se admiten a lo sumo `{0}` elementos",
"pattern": "El valor no cumple el patrón: `{0}`",
"minLength": "El valor debe tener **como mínimo** `{0}` caracteres de longitud",
"maxLength": "El valor debe tener **como máximo** `{0}` caracteres de longitud",
"multipleOf": "El valor debe ser **múltiplo de** `{0}`",
"minimum": "El valor debe ser **mayor o igual que** `{0}`",
"exclusiveMinimum": "El valor debe ser **mayor que** `{0}`",
"maximum": "El valor debe ser **menor o igual que** `{0}`",
"exclusiveMaximum": "El valor debe ser **menor que** `{0}`",
"minProperties": "Se requieren como mínimo `{0}` propiedades",
"maxProperties": "Se admiten a lo sumo `{0}` propiedades",
"uniqueItems": "Los elementos del array deben ser diferentes",
"addItem": "Añadir elemento",
"true": "Verdadero",
"false": "Falso"
};
if ("undefined" === typeof brutusin || "undefined" === typeof brutusin["json-forms"]) {
throw new Error("brutusin-json-forms-bootstrap.js requires brutusin-json-forms.js");
}
(function () {
var BrutusinForms = brutusin["json-forms"];

BrutusinForms.messages = {
"validationError": "Error de validación",
"required": "Este campo es **obligatorio**",
"invalidValue": "Valor inválido",
"addpropNameExistent": "Esta propiedad ya existe en el objeto",
"addpropNameRequired": "Un nombre es obligatorio",
"minItems": "Se requiere un mínimo de `{0}` elementos",
"maxItems": "Se admiten a lo sumo `{0}` elementos",
"pattern": "El valor no cumple el patrón: `{0}`",
"minLength": "El valor debe tener **como mínimo** `{0}` caracteres de longitud",
"maxLength": "El valor debe tener **como máximo** `{0}` caracteres de longitud",
"multipleOf": "El valor debe ser **múltiplo de** `{0}`",
"minimum": "El valor debe ser **mayor o igual que** `{0}`",
"exclusiveMinimum": "El valor debe ser **mayor que** `{0}`",
"maximum": "El valor debe ser **menor o igual que** `{0}`",
"exclusiveMaximum": "El valor debe ser **menor que** `{0}`",
"minProperties": "Se requieren como mínimo `{0}` propiedades",
"maxProperties": "Se admiten a lo sumo `{0}` propiedades",
"uniqueItems": "Los elementos del array deben ser diferentes",
"addItem": "Añadir elemento",
"true": "Verdadero",
"false": "Falso"
};
}());
30 changes: 30 additions & 0 deletions src/js/addon/brutusin-json-forms-lan-fr-FR.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
if ("undefined" === typeof brutusin || "undefined" === typeof brutusin["json-forms"]) {
throw new Error("brutusin-json-forms-bootstrap.js requires brutusin-json-forms.js");
}
(function () {
var BrutusinForms = brutusin["json-forms"];

BrutusinForms.messages = {
"validationError": "Erreur de validation",
"required": "Ce champ est obligatoire",
"invalidValue": "Valeur du champ invalide",
"addpropNameExistent": "Cet propriété est déjà présente dans l'objet",
"addpropNameRequired": "Un nom est obligatoire",
"minItems": "Au moins {0} éléments sont requis",
"maxItems": "Au plus {0} élément sont autorisés",
"pattern": "La valeur n'est pas conforme au patron: {0}",
"minLength": "La valeur doit être au moins de {0} caractères",
"maxLength": "La valeur doit être *au maximum de {0} caractères",
"multipleOf": "La valeur doit être multiple de {0}",
"minimum": "La valeur doit être supérieur ou égale à {0}",
"exclusiveMinimum": "La valeur doit être supérieur à {0}",
"maximum": "La valeur doit inférieur ou égale à{0}",
"exclusiveMaximum": "La valeur doit être inférieur à {0}",
"minProperties": "Au moins {0} propriétés sont obligatoire",
"maxProperties": "Au plus {0} propriétés sont autorisés",
"uniqueItems": "Les éléments du tableaux doivent être unique",
"addItem": "Ajouter un élément",
"true": "Vrai",
"false": "Faux"
};
}());
30 changes: 0 additions & 30 deletions src/js/brutusin-json-forms-lan-es_ES.js

This file was deleted.

81 changes: 54 additions & 27 deletions src/js/brutusin-json-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,7 @@ if (typeof brutusin === "undefined") {
appendChild(container, display, s);

};

renderers["object"] = function (container, id, parentObject, propertyProvider, value) {

function createStaticPropertyProvider(propname) {
Expand Down Expand Up @@ -967,7 +968,9 @@ if (typeof brutusin === "undefined") {
}

function renameRequiredPropeties(schema) {
if (schema.hasOwnProperty("oneOf")) {
if (!schema) {
return;
} else if (schema.hasOwnProperty("oneOf")) {
for (var i in schema.oneOf) {
renameRequiredPropeties(schema.oneOf[i]);
}
Expand Down Expand Up @@ -1010,7 +1013,9 @@ if (typeof brutusin === "undefined") {
pseudoSchema["$id"] = name;
schemaMap[name] = pseudoSchema;

if (schema.hasOwnProperty("oneOf")) {
if (!schema) {
return;
} else if (schema.hasOwnProperty("oneOf")) {
pseudoSchema.oneOf = new Array();
pseudoSchema.type = "oneOf";
for (var i in schema.oneOf) {
Expand All @@ -1020,21 +1025,22 @@ if (typeof brutusin === "undefined") {
}
} else if (schema.hasOwnProperty("$ref")) {
var refSchema = getDefinition(schema["$ref"]);
if (schema.hasOwnProperty("title") || schema.hasOwnProperty("description")) {
var clonedRefSchema = {};
for (var prop in refSchema) {
clonedRefSchema[prop] = refSchema[prop];
}
if (schema.hasOwnProperty("title")) {
clonedRefSchema.title = schema.title;
}
if (schema.hasOwnProperty("description")) {
clonedRefSchema.description = schema.description;
if (refSchema) {
if (schema.hasOwnProperty("title") || schema.hasOwnProperty("description")) {
var clonedRefSchema = {};
for (var prop in refSchema) {
clonedRefSchema[prop] = refSchema[prop];
}
if (schema.hasOwnProperty("title")) {
clonedRefSchema.title = schema.title;
}
if (schema.hasOwnProperty("description")) {
clonedRefSchema.description = schema.description;
}
refSchema = clonedRefSchema;
}
refSchema = clonedRefSchema;
populateSchemaMap(name, refSchema);
}
populateSchemaMap(name, refSchema);

} else if (schema.type === "object") {
if (schema.properties) {
pseudoSchema.properties = new Object();
Expand Down Expand Up @@ -1195,6 +1201,25 @@ if (typeof brutusin === "undefined") {
}
}
r(container, id, parentObject, propertyProvider, value);
} else if (s.$ref) {
if (obj.schemaResolver) {
var cb = function (schemas) {
if (schemas && schemas.hasOwnProperty(id)) {
if (JSON.stringify(schemaMap[id]) !== JSON.stringify(schemas[id])) {
cleanSchemaMap(id);
cleanData(id);
populateSchemaMap(id, schemas[id]);
var renderInfo = renderInfoMap[id];
if (renderInfo) {
render(renderInfo.titleContainer, renderInfo.container, id, renderInfo.parentObject, renderInfo.propertyProvider, renderInfo.value);
}
}
}
BrutusinForms.onResolutionFinished(parentObject);
};
BrutusinForms.onResolutionStarted(parentObject);
obj.schemaResolver([id], obj.getData(), cb);
}
}
}

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

function onDependencyChanged(name, source) {
function cleanSchemaMap(schemaId) {
for (var prop in schemaMap) {
if (schemaId.startsWith(prop)) {
delete schemaMap[prop];
}
function cleanSchemaMap(schemaId) {
for (var prop in schemaMap) {
if (schemaId.startsWith(prop)) {
delete schemaMap[prop];
}
}
function cleanData(schemaId) {
var expression = new Expression(schemaId);
expression.visit(data, function (data, parent, property) {
delete parent[property];
});
}
}
function cleanData(schemaId) {
var expression = new Expression(schemaId);
expression.visit(data, function (data, parent, property) {
delete parent[property];
});
}

function onDependencyChanged(name, source) {

var arr = dependencyMap[name];
if (!arr || !obj.schemaResolver) {
return;
Expand Down

0 comments on commit e4f9ac5

Please sign in to comment.