Finally figured out how to use i18next interpolation correctly; using it on level counts in SubscribeModal

This commit is contained in:
Nick Winter 2016-04-28 10:07:40 -07:00
parent d666e4e39c
commit 747c5f29f7
4 changed files with 12 additions and 14 deletions

View file

@ -65,6 +65,7 @@ Application = initialize: ->
lng: me.get('preferredLanguage', true)
fallbackLng: 'en'
resStore: locale
useDataAttrOptions: true
#debug: true
#sendMissing: true
#sendMissingTo: 'current'

View file

@ -1,12 +1,4 @@
module.exports = nativeDescription: "English", englishDescription: "English", translation:
# Don't translate this block nor copy it to other locale files.
# This is just raw data that is automatically shared across all locales.
data:
levelsCount: "125"
bonusLevelsCount: "85"
heroesCount: "10"
worldsCount: "4"
home:
slogan: "Learn to Code by Playing a Game"
no_ie: "CodeCombat does not run in Internet Explorer 8 or older. Sorry!" # Warning that only shows up in IE8 and older
@ -560,9 +552,9 @@
subscribe:
comparison_blurb: "Sharpen your skills with a CodeCombat subscription!"
feature1: "$t(data.levelsCount)+ basic levels across $t(data.worldsCount) worlds"
feature2: "$t(data.heroesCount) powerful <strong>new heroes</strong> with unique skills!"
feature3: "$t(data.bonusLevelsCount)+ bonus levels"
feature1: "__levelsCount__+ basic levels across __worldsCount__ worlds"
feature2: "__heroesCount__ powerful <strong>new heroes</strong> with unique skills!"
feature3: "__bonusLevelsCount__+ bonus levels"
feature4: "<strong>{{gems}} bonus gems</strong> every month!"
feature5: "Video tutorials"
feature6: "Premium email support"

View file

@ -32,7 +32,7 @@
tbody
tr
td.feature-description
span(data-i18n="subscribe.feature1")
span(data-i18n="subscribe.feature1", data-i18n-options='{"levelsCount": ' + view.i18nData.levelsCount + ', "worldsCount": ' + view.i18nData.worldsCount + '}')
if !me.isOnPremiumServer()
td.center-ok.free-cell
span.glyphicon.glyphicon-ok
@ -40,14 +40,14 @@
span.glyphicon.glyphicon-ok
tr
td.feature-description
span(data-i18n="[html]subscribe.feature2")
span(data-i18n="[html]subscribe.feature2", data-i18n-options='{"heroesCount": ' + view.i18nData.heroesCount + '}')
if !me.isOnPremiumServer()
td.free-cell
td.center-ok
span.glyphicon.glyphicon-ok
tr
td.feature-description
span(data-i18n="subscribe.feature3")
span(data-i18n="subscribe.feature3", data-i18n-options='{"bonusLevelsCount": ' + view.i18nData.bonusLevelsCount + '}'))
if !me.isOnPremiumServer()
td.free-cell
td.center-ok

View file

@ -11,6 +11,11 @@ module.exports = class SubscribeModal extends ModalView
plain: true
closesOnClickOutside: false
planID: 'basic'
i18nData:
levelsCount: '145'
worldsCount: '5'
heroesCount: '14'
bonusLevelsCount: '95'
subscriptions:
'stripe:received-token': 'onStripeReceivedToken'