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 { div.jsoneditor-tree div.jsoneditor-show-more a {
display: inline-block;
color: #808080; color: #808080;
} }

View File

@ -32,6 +32,9 @@ var _defs = {
'removeText': 'Remove', 'removeText': 'Remove',
'removeTitle': 'Remove selected fields (Ctrl+Del)', 'removeTitle': 'Remove selected fields (Ctrl+Del)',
'removeField': 'Remove this field (Ctrl+Del)', 'removeField': 'Remove this field (Ctrl+Del)',
'showAll': 'show all',
'showMore': 'show more',
'showMoreStatus': 'displaying ${maxVisibleChilds} of ${totalChilds} items.',
'sort': 'Sort', 'sort': 'Sort',
'sortTitle': 'Sort the childs of this ', 'sortTitle': 'Sort the childs of this ',
'string': 'String', 'string': 'String',
@ -81,6 +84,12 @@ var _defs = {
'removeText': 'Remover', 'removeText': 'Remover',
'removeTitle': 'Remover campos selecionados (Ctrl+Del)', 'removeTitle': 'Remover campos selecionados (Ctrl+Del)',
'removeField': 'Remover este campo (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', 'sort': 'Organizar',
'sortTitle': 'Organizar os filhos deste ', 'sortTitle': 'Organizar os filhos deste ',
'string': 'Texto', 'string': 'Texto',

View File

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