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
|
2015-01-29 12:07:25 -05:00
|
|
|
id: 'i18n-edit-level-view'
|
2014-10-27 20:11:48 -04:00
|
|
|
modelClass: Level
|
|
|
|
|
|
|
|
buildTranslationList: ->
|
|
|
|
lang = @selectedLanguage
|
|
|
|
|
|
|
|
# name, description
|
|
|
|
if i18n = @model.get('i18n')
|
|
|
|
if name = @model.get('name')
|
2015-01-29 12:07:25 -05:00
|
|
|
@wrapRow 'Level name', ['name'], name, i18n[lang]?.name, []
|
2014-10-27 20:11:48 -04:00
|
|
|
if description = @model.get('description')
|
2015-01-29 12:07:25 -05:00
|
|
|
@wrapRow 'Level description', ['description'], description, i18n[lang]?.description, []
|
2014-11-12 18:00:24 -05:00
|
|
|
if loadingTip = @model.get('loadingTip')
|
2015-01-29 12:07:25 -05:00
|
|
|
@wrapRow 'Loading tip', ['loadingTip'], loadingTip, i18n[lang]?.loadingTip, []
|
2014-10-27 20:11:48 -04:00
|
|
|
|
|
|
|
# goals
|
|
|
|
for goal, index in @model.get('goals') ? []
|
|
|
|
if i18n = goal.i18n
|
2015-01-29 12:07:25 -05:00
|
|
|
@wrapRow 'Goal name', ['name'], goal.name, i18n[lang]?.name, ['goals', index]
|
2014-10-27 20:11:48 -04:00
|
|
|
|
|
|
|
# documentation
|
|
|
|
for doc, index in @model.get('documentation')?.specificArticles ? []
|
|
|
|
if i18n = doc.i18n
|
2015-01-29 12:07:25 -05:00
|
|
|
@wrapRow 'Guide article name', ['name'], doc.name, i18n[lang]?.name, ['documentation', 'specificArticles', index]
|
2015-04-08 12:51:54 -04:00
|
|
|
@wrapRow "'#{doc.name}' body", ['body'], doc.body, i18n[lang]?.body, ['documentation', 'specificArticles', index], 'markdown'
|
2014-10-29 00:15:41 -04:00
|
|
|
|
2016-05-25 18:29:57 -04:00
|
|
|
# hints
|
|
|
|
for hint, index in @model.get('documentation')?.hints ? []
|
|
|
|
if i18n = hint.i18n
|
|
|
|
name = "Hint #{index+1}"
|
|
|
|
@wrapRow "'#{name}' body", ['body'], hint.body, i18n[lang]?.body, ['documentation', 'hints', index], 'markdown'
|
|
|
|
|
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
|
2015-01-29 12:07:25 -05:00
|
|
|
@wrapRow 'Sprite text', ['text'], spriteCommand.say.text, i18n[lang]?.text, pathPrefix, 'markdown'
|
2014-10-27 20:11:48 -04:00
|
|
|
if spriteCommand.say.blurb
|
2015-01-29 12:07:25 -05:00
|
|
|
@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
|
2015-01-29 12:07:25 -05:00
|
|
|
@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
|
2015-01-29 12:07:25 -05:00
|
|
|
@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]
|
2015-03-01 12:40:05 -05:00
|
|
|
@wrapRow 'Code comment', ['context', key], value, i18n[lang]?.context?[key], path
|