Clean up legal string interpolation
This commit is contained in:
parent
e9b59d62d6
commit
e1130ff1e8
3 changed files with 9 additions and 14 deletions
app
|
@ -1569,7 +1569,7 @@
|
||||||
email_settings_url: "your email settings"
|
email_settings_url: "your email settings"
|
||||||
email_description_suffix: "or through links in the emails we send, you can change your preferences and easily unsubscribe at any time."
|
email_description_suffix: "or through links in the emails we send, you can change your preferences and easily unsubscribe at any time."
|
||||||
cost_title: "Cost"
|
cost_title: "Cost"
|
||||||
cost_description: "CodeCombat is free to play for all of its core levels, with a ${{price}} USD/mo subscription for access to extra level branches and {{gems}} bonus gems per month. You can cancel with a click, and we offer a 100% money-back guarantee."
|
cost_description_a: "CodeCombat is free to play for all of its core levels, with a ${{price}} USD/mo subscription for access to extra level branches and {{gems}} bonus gems per month. You can cancel with a click, and we offer a 100% money-back guarantee."
|
||||||
copyrights_title: "Copyrights and Licenses"
|
copyrights_title: "Copyrights and Licenses"
|
||||||
contributor_title: "Contributor License Agreement"
|
contributor_title: "Contributor License Agreement"
|
||||||
contributor_description_prefix: "All contributions, both on the site and on our GitHub repository, are subject to our"
|
contributor_description_prefix: "All contributions, both on the site and on our GitHub repository, are subject to our"
|
||||||
|
|
|
@ -52,7 +52,7 @@ block content
|
||||||
if !me.isOnPremiumServer()
|
if !me.isOnPremiumServer()
|
||||||
h4(data-i18n="legal.cost_title")
|
h4(data-i18n="legal.cost_title")
|
||||||
| Cost
|
| Cost
|
||||||
p#cost-description(data-i18n="legal.cost_description")
|
p#cost-description Loading...
|
||||||
|
|
||||||
h2(data-i18n="legal.copyrights_title")
|
h2(data-i18n="legal.copyrights_title")
|
||||||
| Copyrights and Licenses
|
| Copyrights and Licenses
|
||||||
|
|
|
@ -10,17 +10,12 @@ module.exports = class LegalView extends RootView
|
||||||
@products = new Products()
|
@products = new Products()
|
||||||
@supermodel.loadCollection(@products, 'products')
|
@supermodel.loadCollection(@products, 'products')
|
||||||
|
|
||||||
onLoaded: ->
|
|
||||||
basicSub = @products.findWhere({name: 'basic_subscription'})
|
|
||||||
@price = (basicSub.get('amount') / 100).toFixed(2)
|
|
||||||
@gems = basicSub.get('gems')
|
|
||||||
super()
|
|
||||||
|
|
||||||
afterRender: ->
|
afterRender: ->
|
||||||
super()
|
super()
|
||||||
# TODO: Figure out how to use i18n interpolation in this case
|
basicSub = @products.findWhere({name: 'basic_subscription'})
|
||||||
$el = @$('#cost-description')
|
return unless basicSub
|
||||||
f = =>
|
text = $.i18n.t('legal.cost_description_a')
|
||||||
$el.text($el.text().replace('{{price}}', @price))
|
text = text.replace('{{price}}', (basicSub.get('amount') / 100).toFixed(2))
|
||||||
$el.text($el.text().replace('{{gems}}', @gems))
|
text = text.replace('{{gems}}', basicSub.get('gems'))
|
||||||
_.defer(f) # i18n call gets made immediately after render
|
@$('#cost-description').text(text)
|
||||||
|
|
||||||
|
|
Reference in a new issue