mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-01 00:15:00 -04: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
app
schemas/models
templates/play/level/tome
views
|
@ -23,7 +23,7 @@ PropertyDocumentationSchema = c.object {
|
||||||
required: ['name', 'type', 'description']
|
required: ['name', 'type', 'description']
|
||||||
},
|
},
|
||||||
name: {type: 'string', title: 'Name', description: 'Name of the property.'}
|
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: {
|
context: {
|
||||||
type: 'object'
|
type: 'object'
|
||||||
title: 'Example template context'
|
title: 'Example template context'
|
||||||
|
|
|
@ -10,6 +10,10 @@ h4
|
||||||
span(data-i18n="skill_docs.read_only") read-only
|
span(data-i18n="skill_docs.read_only") read-only
|
||||||
| )
|
| )
|
||||||
|
|
||||||
|
if doc.translatedShortName
|
||||||
|
h5
|
||||||
|
span.translated-name= doc.translatedShortName
|
||||||
|
|
||||||
.description
|
.description
|
||||||
p!= marked(doc.description || 'Still undocumented, sorry.')
|
p!= marked(doc.description || 'Still undocumented, sorry.')
|
||||||
if cooldowns && (cooldowns.cooldown || cooldowns.specificCooldown)
|
if cooldowns && (cooldowns.cooldown || cooldowns.specificCooldown)
|
||||||
|
@ -145,4 +149,4 @@ if item
|
||||||
|
|
||||||
if selectedMethod
|
if selectedMethod
|
||||||
p
|
p
|
||||||
em Write the body of this method below.
|
em Write the body of this method below.
|
||||||
|
|
|
@ -15,6 +15,7 @@ module.exports = class I18NEditComponentView extends I18NEditModelView
|
||||||
#- Component property descriptions
|
#- Component property descriptions
|
||||||
if i18n = propDoc.i18n
|
if i18n = propDoc.i18n
|
||||||
path = ['propertyDocumentation', propDocIndex]
|
path = ['propertyDocumentation', propDocIndex]
|
||||||
|
@wrapRow "#{propDoc.name} name value", ['name'], propDoc.name, i18n[lang]?.name, path
|
||||||
if _.isObject propDoc.description
|
if _.isObject propDoc.description
|
||||||
for progLang, description of propDoc.description
|
for progLang, description of propDoc.description
|
||||||
@wrapRow "#{propDoc.name} description (#{progLang})", ['description', progLang], description, i18n[lang]?[progLang]?.description, path, 'markdown'
|
@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)
|
else if (@options.language in ['python', 'lua']) and (@doc.owner is 'this' or @options.tabbify)
|
||||||
@doc.shorterName = @doc.shortName.replace /^(self|hero)[:.]/, ''
|
@doc.shorterName = @doc.shortName.replace /^(self|hero)[:.]/, ''
|
||||||
@doc.title = if @options.shortenize then @doc.shorterName else @doc.shortName
|
@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.
|
# Grab the language-specific documentation for some sub-properties, if we have it.
|
||||||
toTranslate = [{obj: @doc, prop: 'description'}, {obj: @doc, prop: 'example'}]
|
toTranslate = [{obj: @doc, prop: 'description'}, {obj: @doc, prop: 'example'}]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue