codecombat/app/views/i18n/I18NEditLevelView.coffee

48 lines
No EOL
2.2 KiB
CoffeeScript

I18NEditModelView = require './I18NEditModelView'
Level = require 'models/Level'
module.exports = class I18NEditLevelView extends I18NEditModelView
id: "i18n-edit-level-view"
modelClass: Level
buildTranslationList: ->
lang = @selectedLanguage
# name, description
if i18n = @model.get('i18n')
if name = @model.get('name')
@wrapRow "Level name", ['name'], name, i18n[lang]?.name, []
if description = @model.get('description')
@wrapRow "Level description", ['description'], description, i18n[lang]?.description, []
# goals
for goal, index in @model.get('goals') ? []
if i18n = goal.i18n
@wrapRow "Goal name", ['name'], goal.name, i18n[lang]?.name, ['goals', index]
# documentation
for doc, index in @model.get('documentation')?.specificArticles ? []
if i18n = doc.i18n
@wrapRow "Guide article name", ['name'], doc.name, i18n[lang]?.name, ['documentation', 'specificArticles', index]
@wrapRow "'#{doc.name}' description", ['description'], doc.description, i18n[lang]?.description, ['documentation', 'specificArticles', index], 'markdown'
# sprite dialogues
for script, scriptIndex in @model.get('scripts') ? []
for noteGroup, noteGroupIndex in script.noteChain ? []
for spriteCommand, spriteCommandIndex in noteGroup.sprites ? []
pathPrefix = ['scripts', scriptIndex, 'noteChain', noteGroupIndex, 'sprites', spriteCommandIndex, 'say']
if i18n = spriteCommand.say?.i18n
if spriteCommand.say.text
@wrapRow "Sprite text", ['text'], spriteCommand.say.text, i18n[lang]?.text, pathPrefix, 'markdown'
if spriteCommand.say.blurb
@wrapRow "Sprite blurb", ['blurb'], spriteCommand.say.blurb, i18n[lang]?.blurb, pathPrefix
for response, responseIndex in spriteCommand.say?.responses ? []
if i18n = response.i18n
@wrapRow "Response button", ['text'], response.text, i18n[lang]?.text, pathPrefix.concat(['responses', responseIndex])
# victory modal
if i18n = @model.get('victory')?.i18n
@wrapRow "Victory text", ['body'], @model.get('victory').body, i18n[lang]?.body, ['victory'], 'markdown'