Skip to content

Commit

Permalink
fix (translator): revert to old format
Browse files Browse the repository at this point in the history
  • Loading branch information
HeitorMatt committed Sep 17, 2020
1 parent 4a4a9a5 commit 79ada9e
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions src/adonisjs/public/translator/translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,7 @@ class Translator {
scramble: true,
options: {}
}, compiled[c - 1]._source)
this._transferOption(optionGroup.options, compiled[c - 1])
this._transferOption(optionGroup.options, compiled[c-1])
compiled[c - 1] = optionGroup
}
if (optionGroup != null) {
Expand All @@ -748,19 +748,19 @@ class Translator {
}
}

_transferOption (options, compiledItem) {
options[compiledItem.label] = {
target: (compiledItem.target)
? compiledItem.target : '(default)'
}
if (compiledItem.message) {
options[compiledItem.label].message =
_transferOption(options, compiledItem) {
options[compiledItem.label] = {
target: (compiledItem.target)
? compiledItem.target : '(default)'
}
if (compiledItem.message) {
options[compiledItem.label].message =
compiledItem.message
}
if (compiledItem.state) {
options[compiledItem.label].state = compiledItem.state
options[compiledItem.label].operation = compiledItem.operation
}
}
if (compiledItem.state) {
options[compiledItem.label].state = compiledItem.state
options[compiledItem.label].operation = compiledItem.operation
}
}

// check if both are quoted or subordinated
Expand Down Expand Up @@ -1532,7 +1532,10 @@ class Translator {
if (matchArray[3] != null) { option.divert = matchArray[3].trim() }
if (matchArray[4] != null) { option.target = matchArray[4].trim() }
if (matchArray[5] != null) { option.message = matchArray[5].trim() }
if (matchArray[6] != null) { option.operation = matchArray[6].trim() } else if (matchArray[8] != null) { option.operation = matchArray[8].trim() }
if (matchArray[6] != null)
{ option.operation = matchArray[6].trim() }
else if (matchArray[8] != null)
{ option.operation = matchArray[8].trim() }
if (matchArray[7] != null) { option.state = matchArray[7].trim() }

return option
Expand Down Expand Up @@ -1579,7 +1582,8 @@ class Translator {

_optionObjToMd (obj) {
let state = ''
if (obj.state && obj.operation) { state = ' ' + ((obj.operation == '>') ? '>' : '') + '((' + obj.state + '))' + ((obj.operation == '?') ? '?' : '') }
if (obj.state && obj.operation)
state = ' ' + ((obj.operation == ">") ? '>' : '') + '((' + obj.state + '))' + ((obj.operation == "?") ? '?' : '')
return Translator.markdownTemplates.option
.replace('{subtype}', (obj.subtype == '_') ? '' : obj.subtype + ' ')
.replace('{label}', (obj.label) ? obj.label : '')
Expand Down Expand Up @@ -1952,15 +1956,16 @@ class Translator {
first = false
const option = obj.options[op]
let state = ''
if (option.state && option.operation) { state = ' ' + ((option.operation == '>') ? '>' : '') + '((' + option.state + '))' + ((option.operation == '?') ? '?' : '') }
if (option.state && option.operation)
state = ' ' + ((option.operation == ">") ? '>' : '') + '((' + option.state + '))' + ((option.operation == "?") ? '?' : '')
md += Translator.markdownTemplates.choice
.replace('{label}', op)
.replace('{target}',
(option.target && option.target != '(default)')
? option.target : '')
.replace('{message}',
(option.message ? '"' + option.message + '"' : ''))
.replace('{state}', state)
.replace("{state}", state)
}
} else {
let extraAttr = ''
Expand Down

0 comments on commit 79ada9e

Please sign in to comment.