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