mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 23:58:02 -05:00
Make LevelComponent names translatable, show spell name translations in doc tooltips
This commit is contained in:
parent
70999fa150
commit
02d833639b
4 changed files with 11 additions and 2 deletions
|
@ -23,7 +23,7 @@ PropertyDocumentationSchema = c.object {
|
|||
required: ['name', 'type', 'description']
|
||||
},
|
||||
name: {type: 'string', title: 'Name', description: 'Name of the property.'}
|
||||
i18n: { type: 'object', format: 'i18n', props: ['description', 'context'], description: 'Help translate this property'}
|
||||
i18n: { type: 'object', format: 'i18n', props: ['name', 'description', 'context'], description: 'Help translate this property'}
|
||||
context: {
|
||||
type: 'object'
|
||||
title: 'Example template context'
|
||||
|
|
|
@ -10,6 +10,10 @@ h4
|
|||
span(data-i18n="skill_docs.read_only") read-only
|
||||
| )
|
||||
|
||||
if doc.translatedShortName
|
||||
h5
|
||||
span.translated-name= doc.translatedShortName
|
||||
|
||||
.description
|
||||
p!= marked(doc.description || 'Still undocumented, sorry.')
|
||||
if cooldowns && (cooldowns.cooldown || cooldowns.specificCooldown)
|
||||
|
|
|
@ -15,6 +15,7 @@ module.exports = class I18NEditComponentView extends I18NEditModelView
|
|||
#- Component property descriptions
|
||||
if i18n = propDoc.i18n
|
||||
path = ['propertyDocumentation', propDocIndex]
|
||||
@wrapRow "#{propDoc.name} name value", ['name'], propDoc.name, i18n[lang]?.name, path
|
||||
if _.isObject propDoc.description
|
||||
for progLang, description of propDoc.description
|
||||
@wrapRow "#{propDoc.name} description (#{progLang})", ['description', progLang], description, i18n[lang]?[progLang]?.description, path, 'markdown'
|
||||
|
|
|
@ -86,6 +86,10 @@ module.exports = class DocFormatter
|
|||
else if (@options.language in ['python', 'lua']) and (@doc.owner is 'this' or @options.tabbify)
|
||||
@doc.shorterName = @doc.shortName.replace /^(self|hero)[:.]/, ''
|
||||
@doc.title = if @options.shortenize then @doc.shorterName else @doc.shortName
|
||||
translatedName = utils.i18n(@doc, 'name')
|
||||
if translatedName isnt @doc.name
|
||||
@doc.translatedShortName = @doc.shortName.replace(@doc.name, translatedName)
|
||||
|
||||
|
||||
# Grab the language-specific documentation for some sub-properties, if we have it.
|
||||
toTranslate = [{obj: @doc, prop: 'description'}, {obj: @doc, prop: 'example'}]
|
||||
|
|
Loading…
Reference in a new issue