mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 15:48:11 -05:00
Achievements are now i18n'able
This commit is contained in:
parent
d6f5b7512d
commit
8ae116200f
10 changed files with 26 additions and 11 deletions
|
@ -939,6 +939,8 @@
|
|||
no_singleplayer: "No Singleplayer games played yet."
|
||||
no_multiplayer: "No Multiplayer games played yet."
|
||||
no_achievements: "No Achievements earned yet."
|
||||
favorite_prefix: "Favorite language is "
|
||||
favorite_postfix: "."
|
||||
|
||||
achievements:
|
||||
last_earned: "Last Earned"
|
||||
|
|
|
@ -51,3 +51,7 @@ module.exports = class Achievement extends CocoModel
|
|||
defer
|
||||
|
||||
getLockedImageURL: -> @lockedImageURL
|
||||
|
||||
i18nName: -> utils.i18n @attributes, 'name'
|
||||
|
||||
i18nDescription: -> utils.i18n @attributes, 'description'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CocoModel = require './CocoModel'
|
||||
util = require '../lib/utils'
|
||||
utils = require '../lib/utils'
|
||||
|
||||
module.exports = class EarnedAchievement extends CocoModel
|
||||
@className: 'EarnedAchievement'
|
||||
|
|
|
@ -78,6 +78,10 @@ _.extend AchievementSchema.properties,
|
|||
default: {kind: 'linear', parameters: a: 1}
|
||||
required: ['kind', 'parameters']
|
||||
additionalProperties: false
|
||||
i18n: c.object
|
||||
format: 'i18n'
|
||||
props: ['name', 'description']
|
||||
description: 'Help translate this achievement'
|
||||
|
||||
_.extend AchievementSchema, # Let's have these on the bottom
|
||||
# TODO We really need some required properties in my opinion but this makes creating new achievements impossible as it is now
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
width: 100%
|
||||
> a
|
||||
border-radius: 0
|
||||
border-width: 1px 0px
|
||||
border-width: 1px 0px 0px 0px
|
||||
border-color: darkgrey
|
||||
&:hover
|
||||
border-color: #888
|
|
@ -11,8 +11,8 @@ block append content
|
|||
.row
|
||||
h2.achievement-category-title(data-i18n="category_#{category}")=category
|
||||
each achievement, index in achievements
|
||||
- var title = achievement.get('name');
|
||||
- var description = achievement.get('description');
|
||||
- var title = achievement.i18nName();
|
||||
- var description = achievement.i18nDescription();
|
||||
- var locked = ! achievement.get('unlocked');
|
||||
- var style = achievement.getStyle()
|
||||
- var imgURL = achievement.getImageURL();
|
||||
|
@ -35,8 +35,8 @@ block append content
|
|||
each earnedAchievement in earnedAchievements.models
|
||||
- var achievement = earnedAchievement.get('achievement');
|
||||
tr
|
||||
td= achievement.get('name')
|
||||
td= achievement.get('description')
|
||||
td= achievement.i18nName()
|
||||
td= achievement.i18nDescription()
|
||||
td= moment().format("MMMM Do YYYY", earnedAchievement.get('changed'))
|
||||
if achievement.isRepeatable()
|
||||
td= earnedAchievement.get('achievedAmount')
|
||||
|
|
|
@ -10,8 +10,10 @@ block append content
|
|||
div.profile-info
|
||||
h3.name= user.get('name')
|
||||
if favoriteLanguage
|
||||
div.extra-info Favorite language is
|
||||
strong.spl.spr= favoriteLanguage
|
||||
div.extra-info
|
||||
span(data-i18n="user.favorite_prefix") Favorite language is
|
||||
strong.favorite-language= favoriteLanguage
|
||||
span(data-i18n="user.favorite_postfix") .
|
||||
.btn-group-vertical.profile-menu
|
||||
a.btn.btn-default(href="/user/#{user.getSlugOrID()}/profile")
|
||||
i.glyphicon.glyphicon-briefcase
|
||||
|
|
|
@ -42,9 +42,9 @@ module.exports = class AchievementPopup extends CocoView
|
|||
#console.debug "Need a total of #{nextLevelXP - currentLevelExp}, already had #{previousXP} and just now earned #{achievedXP} totalling on #{currentXP}"
|
||||
|
||||
data =
|
||||
title: @achievement.get('name')
|
||||
title: @achievement.i18nName()
|
||||
imgURL: @achievement.getImageURL()
|
||||
description: @achievement.get('description')
|
||||
description: @achievement.i18nDescription()
|
||||
level: currentLevel
|
||||
currentXP: currentXP
|
||||
newXP: achievedXP
|
||||
|
@ -75,7 +75,6 @@ module.exports = class AchievementPopup extends CocoView
|
|||
@$el.remove()
|
||||
@destroy()
|
||||
|
||||
|
||||
getContainer: ->
|
||||
unless @container
|
||||
@container = $('.achievement-popup-container')
|
||||
|
|
|
@ -10,6 +10,9 @@ module.exports.DungeonArenaStarted = DungeonArenaStarted =
|
|||
collection: 'level.session'
|
||||
query: "{\"level.original\":\"dungeon-arena\"}"
|
||||
userField: 'creator'
|
||||
i18n:
|
||||
es:
|
||||
name: 'Dungeon Arenos Started'
|
||||
|
||||
module.exports.Simulated = Simulated =
|
||||
_id: '53ba76249259823746b6b482'
|
||||
|
|
|
@ -7,6 +7,7 @@ fixtures = require '../../fixtures/achievements'
|
|||
|
||||
module.exports = ->
|
||||
me.set 'points', 48
|
||||
me.set 'preferredLanguage', 'es'
|
||||
|
||||
unlockableObj = fixtures.DungeonArenaStarted
|
||||
earnedUnlockableObj =
|
||||
|
|
Loading…
Reference in a new issue