Implemented translate (`pt-BR` still has to be checked for correctness)

This commit is contained in:
jos 2018-05-12 16:53:18 +02:00
parent 3d8ca6df33
commit 8dff972dce
3 changed files with 16 additions and 6 deletions

View File

@ -190,6 +190,7 @@ div.jsoneditor-tree div.jsoneditor-show-more {
}
div.jsoneditor-tree div.jsoneditor-show-more a {
display: inline-block;
color: #808080;
}

View File

@ -32,6 +32,9 @@ var _defs = {
'removeText': 'Remove',
'removeTitle': 'Remove selected fields (Ctrl+Del)',
'removeField': 'Remove this field (Ctrl+Del)',
'showAll': 'show all',
'showMore': 'show more',
'showMoreStatus': 'displaying ${maxVisibleChilds} of ${totalChilds} items.',
'sort': 'Sort',
'sortTitle': 'Sort the childs of this ',
'string': 'String',
@ -81,6 +84,12 @@ var _defs = {
'removeText': 'Remover',
'removeTitle': 'Remover campos selecionados (Ctrl+Del)',
'removeField': 'Remover este campo (Ctrl+Del)',
// TODO: correctly translate showAll
'showAll': 'mostre tudo',
// TODO: correctly translate showMore
'showMore': 'mostre mais',
// TODO: correctly translate showMoreStatus
'showMoreStatus': 'exibindo ${maxVisibleChilds} de ${totalChilds} itens.',
'sort': 'Organizar',
'sortTitle': 'Organizar os filhos deste ',
'string': 'Texto',

View File

@ -40,7 +40,7 @@ function showMoreNodeFactory(Node) {
var me = this;
var parent = this.parent;
var showMoreButton = document.createElement('a');
showMoreButton.appendChild(document.createTextNode('show\u00A0more'));
showMoreButton.appendChild(document.createTextNode(translate('showMore')));
showMoreButton.href = '#';
showMoreButton.onclick = function (event) {
// TODO: use callback instead of accessing a method of the parent
@ -53,7 +53,7 @@ function showMoreNodeFactory(Node) {
};
var showAllButton = document.createElement('a');
showAllButton.appendChild(document.createTextNode('show\u00A0all'));
showAllButton.appendChild(document.createTextNode(translate('showAll')));
showAllButton.href = '#';
showAllButton.onclick = function (event) {
// TODO: use callback instead of accessing a method of the parent
@ -120,10 +120,10 @@ function showMoreNodeFactory(Node) {
};
ShowMoreNode.prototype._getShowMoreText = function() {
// TODO: implement in translate
var childs = this.type === 'array' ? 'items' : 'properties';
return 'displaying ' + this.parent.maxVisibleChilds +
' of ' + this.parent.childs.length + ' ' + childs + '. ';
return translate('showMoreStatus', {
maxVisibleChilds: this.parent.maxVisibleChilds,
totalChilds: this.parent.childs.length
}) + ' ';
};
/**