diff --git a/locales/en/app.json b/locales/en/app.json new file mode 100644 index 0000000000..ccaa36d8ec --- /dev/null +++ b/locales/en/app.json @@ -0,0 +1,10 @@ +{ + "Habit": "Habit", + "Daily": "Daily", + "Todo": "Todo", + "Reward": "Reward", + "Habits": "Habits", + "Dailies": "Dailies", + "Todos": "Todos", + "Rewards": "Rewards" +} \ No newline at end of file diff --git a/locales/he/app.json b/locales/he/app.json new file mode 100644 index 0000000000..83c7bec24e --- /dev/null +++ b/locales/he/app.json @@ -0,0 +1,10 @@ +{ + "Habit": "Habit", + "Daily": "Daily", + "Todo": "Todo", + "Reward": "Reward", + "Habits": "נווו קדימה!", + "Dailies": "Dailies", + "Todos": "Todos", + "Rewards": "Rewards" +} \ No newline at end of file diff --git a/package.json b/package.json index a185c5fd20..40f0d85c07 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "superagent": "~0.12.4", "resolve": "~0.2.3", "browserify": "1.17.3", - "expect.js": "~0.2.0" + "expect.js": "~0.2.0", + "derby-i18n": "0.0.1" }, "private": true, "subdomain": "habitrpg", diff --git a/src/app/browser.coffee b/src/app/browser.coffee index 8f2410001f..ed88fb03e1 100644 --- a/src/app/browser.coffee +++ b/src/app/browser.coffee @@ -114,7 +114,7 @@ setupTour = (model) -> } ] - $('.main-avatar').popover('destroy') #remove previous popovers + $('.main-herobox').popover('destroy') #remove previous popovers tour = new Tour() _.each tourSteps, (step) -> tour.addStep _.defaults step, {html:true} diff --git a/src/app/character.coffee b/src/app/character.coffee index 9478e09768..7b215fb746 100644 --- a/src/app/character.coffee +++ b/src/app/character.coffee @@ -92,17 +92,17 @@ module.exports.app = (appExports, model) -> user.on 'set', 'flags.customizationsNotification', (captures, args) -> return unless captures == true - $('.main-avatar').popover('destroy') #remove previous popovers + $('.main-herobox').popover('destroy') #remove previous popovers html = """ - Click your avatar to customize your appearance. [Close] + Click your avatar to customize your appearance. [Close] """ - $('.main-avatar').popover + $('.main-herobox').popover title: "Customize Your Avatar" placement: 'bottom' trigger: 'manual' html: true content: html - $('.main-avatar').popover 'show' + $('.main-herobox').popover 'show' userSchema = diff --git a/src/app/i18n.coffee b/src/app/i18n.coffee new file mode 100644 index 0000000000..07b233a562 --- /dev/null +++ b/src/app/i18n.coffee @@ -0,0 +1,5 @@ +i18n = require 'derby-i18n' + +i18n.plurals.add 'he', (n) -> n + +module.exports = i18n diff --git a/src/app/index.coffee b/src/app/index.coffee index c1a8b48aba..33f75bee36 100644 --- a/src/app/index.coffee +++ b/src/app/index.coffee @@ -1,10 +1,17 @@ derby = require 'derby' app = derby.createApp module + {get, view, ready} = app derby.use require('derby-ui-boot'), {styles: []} derby.use require '../../ui' derby.use require 'derby-auth/components' +# Translations +i18n = require './i18n' +i18n.localize app, + availableLocales: ['en', 'he'] + defaultLocale: 'en' + # Custom requires character = require './character' tasks = require './tasks' diff --git a/src/app/party.coffee b/src/app/party.coffee index 30592b5557..47fb07fe6c 100644 --- a/src/app/party.coffee +++ b/src/app/party.coffee @@ -71,38 +71,31 @@ module.exports.partySubscribe = partySubscribe = (page, model, params, next, cb) module.exports.app = (appExports, model) -> user = model.at('_user') - unlockPartiesNotification = -> - $('.main-avatar').popover('destroy') #remove previous popovers + user.on 'set', 'flags.partyEnabled', (captures, args) -> + return if (captures != true) or user.get('party.current') + $('.user-menu').popover('destroy') #remove previous popovers html = """
- Congratulations, you have unlocked the Party System! You can now group with your friends by adding their User Ids. - [Close] + Be social, join a party and play Habit with your friends! You'll be better at your habits with accountability partners. LFG anyone? + [Close]
""" - $('.main-avatar').popover - title: "Party System Unlocked" + $('.user-menu').popover + title: "Party System" placement: 'bottom' trigger: 'manual' html: true content: html - $('.main-avatar').popover 'show' + $('.user-menu').popover 'show' - appExports.manuallyUnlockParties = -> - $("#settings-modal").modal("hide") - user.set('flags.partyEnabled', true) - unlockPartiesNotification() - - user.on 'set', 'flags.partyEnabled', (captures, args) -> - unlockPartiesNotification() if captures == true - - #TODO implement this when we have unsubscribe working properly model.on 'set', '_user.party.invitation', (after, before) -> if !before? and after? # they just got invited - # if they haven't unlocked parties yet, unlock it for them - user.set('flags.partyEnabled',true) unless user.get('flags.partyEnabled') - window.setTimeout (-> window.location.reload true), 1000 - #partySubscribe(null, model, null, null, null) + partyQ = model.query('parties').withId(after) + partyQ.fetch (err, party) -> + return next(err) if err + model.ref '_party', party + browser.resetDom(model) appExports.partyCreate = -> newParty = model.get("_newParty") diff --git a/views/app/party.html b/views/app/party.html index aa632630b7..819bdcbbaf 100644 --- a/views/app/party.html +++ b/views/app/party.html @@ -1,43 +1,43 @@ {#if _user.party.current} -

{_party.name}

- - {#each _partyMembers as :member} - - {/} -
{username(:member.auth)}({:member.id})
-
- {#if _view.partyError} -
{_view.partyError}
- {/} -
- - -
-
- Leave +

{_party.name}

+ + {#each _partyMembers as :member} + + {/} +
{username(:member.auth)}({:member.id})
+
+ {#if _view.partyError} +
{_view.partyError}
+ {/} +
+ + +
+
+ Leave {else if _user.party.invitation} -

You're Invited To {_party.name}

- Accept - Reject +

You're Invited To {_party.name}

+ Accept + Reject {else} -

Create A Party

- -

You are not in a party. You can either create one and invite friends, or if you want to join an existing party, have them enter:

-
{_user.id}
-
- {#if _view.partyError} -
{_view.partyError}
- {/} -
- - -
-
+

Create A Party

+ +

You are not in a party. You can either create one and invite friends, or if you want to join an existing party, have them enter:

+
{_user.id}
+
+ {#if _view.partyError} +
{_view.partyError}
+ {/} +
+ + +
+
{/} <@footer> diff --git a/views/app/rewards.html b/views/app/rewards.html index da0eadecf4..37cfb2189c 100644 --- a/views/app/rewards.html +++ b/views/app/rewards.html @@ -20,7 +20,7 @@ {/} -

Rewards

+

{{t("Rewards")}}

{#if equal(_user.flags.petsEnabled,true)} diff --git a/views/app/settings.html b/views/app/settings.html index aa1cd71744..355be6b493 100644 --- a/views/app/settings.html +++ b/views/app/settings.html @@ -20,7 +20,6 @@

Misc

- {#unless _user.flags.partyEnabled} {/} {{#if _user.auth.local}}
@@ -135,18 +134,18 @@
- {#unless _loggedIn} - - {else} - - {/} + {{#unless _loggedIn}} + + {{else}} + + {{/}}
diff --git a/views/app/tasks.html b/views/app/tasks.html index f92feebcdd..3656df8ea0 100644 --- a/views/app/tasks.html +++ b/views/app/tasks.html @@ -4,7 +4,7 @@
-

Habits

+

{{t("Habits")}}

    {#each _habitList as :task}{/}
@@ -13,7 +13,7 @@
-

Daily

+

{{t("Daily")}}

    {#each _dailyList as :task}{/}
@@ -30,7 +30,7 @@ -

Todos

+

{{t("Todos")}}