2014-10-27 20:11:48 -04:00
|
|
|
I18NEditModelView = require './I18NEditModelView'
|
|
|
|
Level = require 'models/Level'
|
2014-10-29 00:15:41 -04:00
|
|
|
LevelComponent = require 'models/LevelComponent'
|
2014-10-27 20:11:48 -04:00
|
|
|
|
|
|
|
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'
|
2014-10-29 00:15:41 -04:00
|
|
|
|
2014-10-27 20:11:48 -04:00
|
|
|
# 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']
|
2014-10-29 00:15:41 -04:00
|
|
|
|
2014-10-27 20:11:48 -04:00
|
|
|
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
|
2014-10-29 00:15:41 -04:00
|
|
|
|
2014-10-27 20:11:48 -04:00
|
|
|
for response, responseIndex in spriteCommand.say?.responses ? []
|
|
|
|
if i18n = response.i18n
|
|
|
|
@wrapRow "Response button", ['text'], response.text, i18n[lang]?.text, pathPrefix.concat(['responses', responseIndex])
|
2014-10-29 00:15:41 -04:00
|
|
|
|
2014-10-27 20:11:48 -04:00
|
|
|
# victory modal
|
|
|
|
if i18n = @model.get('victory')?.i18n
|
|
|
|
@wrapRow "Victory text", ['body'], @model.get('victory').body, i18n[lang]?.body, ['victory'], 'markdown'
|
2014-10-29 00:15:41 -04:00
|
|
|
|
|
|
|
# code comments
|
|
|
|
for thang, thangIndex in @model.get('thangs') ? []
|
|
|
|
for component, componentIndex in thang.components ? []
|
|
|
|
continue unless component.original is LevelComponent.ProgrammableID
|
|
|
|
for methodName, method of component.config?.programmableMethods ? {}
|
|
|
|
if (i18n = method.i18n) and (context = method.context)
|
|
|
|
for key, value of context
|
|
|
|
path = ['thangs', thangIndex, 'components', componentIndex, 'config', 'programmableMethods', methodName]
|
|
|
|
@wrapRow "Code comment", ["context", key], value, i18n[lang]?.context[key], path
|