From 76110423c02f63c148937e18506eb41a0ba79bdb Mon Sep 17 00:00:00 2001 From: Ruben Vereecken Date: Wed, 12 Mar 2014 20:30:43 +0100 Subject: [PATCH 01/11] Created i18n utility function --- app/lib/utils.coffee | 24 +++++++++++++++++++++++- test/app/lib/utils.spec.coffee | 0 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 test/app/lib/utils.spec.coffee diff --git a/app/lib/utils.coffee b/app/lib/utils.coffee index 8fe47dbee..29f1434f2 100644 --- a/app/lib/utils.coffee +++ b/app/lib/utils.coffee @@ -44,4 +44,26 @@ module.exports.hslToHex = (hsl) -> toHex = (n) -> h = Math.floor(n).toString(16) h = '0'+h if h.length is 1 - h \ No newline at end of file + h + +i18n = (say, target, language=me.lang(), fallback='en') -> + generalResult = null + fallbackResult = null + fallforwardResult = null # If a general language isn't available, the first specific one will do + matches = (/\w+/gi).exec(language) + generalName = matches[0] if matches + + for locale in say?.i18n + if target of say[locale] + result = say[locale][target] + else continue + return result if locale == language + generalResult = result if locale == generalName + fallbackResult = result if locale == fallback + fallforwardResult = result if locale.indexOf language != -1 and not fallforwardResult? + + return generalResult if generalResult? + return fallbackResult if fallbackResult? + return fallforwardResult if fallforwardResult? + return say.text if 'text' of say + null \ No newline at end of file diff --git a/test/app/lib/utils.spec.coffee b/test/app/lib/utils.spec.coffee new file mode 100644 index 000000000..e69de29bb From aa0778507a6cdfeb9ef5daf7de352e58c72e7b50 Mon Sep 17 00:00:00 2001 From: Ruben Vereecken Date: Wed, 12 Mar 2014 20:30:56 +0100 Subject: [PATCH 02/11] Created utils test --- test/app/lib/utils.spec.coffee | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/test/app/lib/utils.spec.coffee b/test/app/lib/utils.spec.coffee index e69de29bb..d729517a0 100644 --- a/test/app/lib/utils.spec.coffee +++ b/test/app/lib/utils.spec.coffee @@ -0,0 +1,43 @@ +describe 'utils library', -> + require 'lib/utils' + + beforeEach -> + fixture1 = { + "text": "G'day, Wizard! Come to practice? Well, let's get started...", + "i18n": { + "es-419": { + "text": "¡Buenas, Hechicero! ¿Vienes a practicar? Bueno, empecemos..." + }, + "es-ES": { + "text": "¡Buenas Mago! ¿Vienes a practicar? Bien, empecemos..." + }, + "es": { + "text": "¡Buenas Mago! ¿Vienes a practicar? Muy bien, empecemos..." + }, + "fr": { + "text": "S'lut, Magicien! Venu pratiquer? Ok, bien débutons..." + }, + "pt-BR": { + "text": "Bom dia, feiticeiro! Veio praticar? Então vamos começar..." + }, + "de": { + "text": "'N Tach auch, Zauberer! Kommst Du zum Üben? Dann lass uns anfangen..." + }, + "tr": { + "text": "İyi günler, Büyücü! Antremana mı geldin? Güzel, hadi başlayalım..." + }, + "sv": { + "text": "Godagens, trollkarl! Kommit för att öva? Nå, låt oss börja..." + }, + "en": { + "text": "Ohai Magician!" + } + }, + "sound": { + "mp3": "db/level/52740644904ac0411700067c/gday_wizard_come_to_practice.mp3", + "ogg": "db/level/52740644904ac0411700067c/gday_wizard_come_to_practice.ogg" + } + } + + it 'i18n should find a valid target string', -> + expect(i18n(fixture1, 'text', 'en')).toEqual(fixture1.i18n.en.text) From c2e81db200a39f70d71981ac3c94d21642ef3add Mon Sep 17 00:00:00 2001 From: Ruben Vereecken Date: Wed, 12 Mar 2014 20:46:25 +0100 Subject: [PATCH 03/11] Added i18n to ladder.jade --- app/locale/en.coffee | 10 ++++++++++ app/templates/editor/level/versions.jade | 11 +++++++++++ app/templates/play/ladder.jade | 16 ++++++++-------- 3 files changed, 29 insertions(+), 8 deletions(-) create mode 100644 app/templates/editor/level/versions.jade diff --git a/app/locale/en.coffee b/app/locale/en.coffee index 8931cf74e..e3da5e2d5 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -81,6 +81,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr campaign_player_created: "Player-Created" campaign_player_created_description: "... in which you battle against the creativity of your fellow Artisan Wizards." level_difficulty: "Difficulty: " + play_as: "Play As " contact: contact_us: "Contact CodeCombat" @@ -282,6 +283,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr password: "Password" message: "Message" code: "Code" + ladder: "Ladder" about: who_is_codecombat: "Who is CodeCombat?" @@ -475,3 +477,11 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr ambassador_title_description: "(Support)" counselor_title: "Counselor" counselor_title_description: "(Expert/Teacher)" + + ladder: + please_login: "Please log in first before playing a ladder game." + my_matches: "My Matches" + simulate: "Simulate" + simulation_explanation: "By simulating games you can get your game ranked faster!" + simulate_games: "Simulate Games!" + simulate_all: "RESET AND SIMULATE GAMES" \ No newline at end of file diff --git a/app/templates/editor/level/versions.jade b/app/templates/editor/level/versions.jade new file mode 100644 index 000000000..b40c7b6f0 --- /dev/null +++ b/app/templates/editor/level/versions.jade @@ -0,0 +1,11 @@ +extends /templates/modal/modal_base +include /templates/kinds/versions + +block modal-header-content + h3(data-i18n="general.version_history") Version History + +block modal-body-content + if dataList + +version-history-body() + +block modal-footer-content \ No newline at end of file diff --git a/app/templates/play/ladder.jade b/app/templates/play/ladder.jade index b7de9c539..234804ed6 100644 --- a/app/templates/play/ladder.jade +++ b/app/templates/play/ladder.jade @@ -10,7 +10,7 @@ block content if me.get('anonymous') div#must-log-in p - strong Please log in first before playing a ladder game. + strong(data-i18n="ladder.please_login") Please log in first before playing a ladder game. button.btn.btn-primary(data-toggle="coco-modal", data-target="modal/login", data-i18n="login.log_in") Log In button.btn.btn-primary(data-toggle="coco-modal", data-target="modal/signup", data-i18n="login.sign_up") Create Account @@ -21,7 +21,7 @@ block content for team in teams div.column.col-md-4 a(style="background-color: #{team.primaryColor}", data-team=team.id).play-button.btn.btn-danger.btn-block.btn-lg - span Play As + span(data-i18n="play.play_as") Play As span= team.name div.column.col-md-2 @@ -29,11 +29,11 @@ block content ul.nav.nav-pills li.active - a(href="#ladder", data-toggle="tab") Ladder + a(href="#ladder", data-toggle="tab", data-i18n="general.ladder") Ladder li - a(href="#my-matches", data-toggle="tab") My Matches + a(href="#my-matches", data-toggle="tab", data-i18n="ladder.my_matches") My Matches li - a(href="#simulate", data-toggle="tab") Simulate + a(href="#simulate", data-toggle="tab", data-i18n="ladder.simulate") Simulate div.tab-content .tab-pane.active.well#ladder @@ -45,9 +45,9 @@ block content if simulationStatus | #{simulationStatus} else - | By simulating games you can get your game ranked faster! + span(data-i18n="ladder.simulation_explanation") By simulating games you can get your game ranked faster! p - button.btn.btn-warning.btn-lg.highlight#simulate-button() Simulate Games! + button(data-i18n="ladder.simulate_games").btn.btn-warning.btn-lg.highlight#simulate-button Simulate Games! if me.isAdmin() p - button.btn.btn-danger.btn-lg.highlight#simulate-all-button() RESET AND SIMULATE GAMES \ No newline at end of file + button(data-i18n="ladder.simulate_all").btn.btn-danger.btn-lg.highlight#simulate-all-button RESET AND SIMULATE GAMES \ No newline at end of file From 9f5c0f03be07342a2e9dd0b9fbeb181b28490400 Mon Sep 17 00:00:00 2001 From: Ruben Vereecken Date: Wed, 12 Mar 2014 20:51:38 +0100 Subject: [PATCH 04/11] Added i18n to ladder_tab --- app/locale/en.coffee | 6 +++++- app/templates/play/ladder/ladder_tab.jade | 11 ++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/locale/en.coffee b/app/locale/en.coffee index e3da5e2d5..8812de23b 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -484,4 +484,8 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr simulate: "Simulate" simulation_explanation: "By simulating games you can get your game ranked faster!" simulate_games: "Simulate Games!" - simulate_all: "RESET AND SIMULATE GAMES" \ No newline at end of file + simulate_all: "RESET AND SIMULATE GAMES" + rank: "Rank" + score: "Score" + leaderboard: "Leaderboard" + battle_as: "Battle as" \ No newline at end of file diff --git a/app/templates/play/ladder/ladder_tab.jade b/app/templates/play/ladder/ladder_tab.jade index 9fc48c340..ba6de50b3 100644 --- a/app/templates/play/ladder/ladder_tab.jade +++ b/app/templates/play/ladder/ladder_tab.jade @@ -5,11 +5,11 @@ div#columns.row tr th(colspan=4, style="color: #{team.primaryColor}") span= team.name - span Leaderboard + span(data-i18n="ladder.leaderboard") Leaderboard tr - th Rank - th Score - th.name-col-cell Name + th(data-i18n="ladder.rank") Rank + th(data-i18n="ladder.score") Score + th(data-i18n="general.name").name-col-cell Name th for session, rank in team.leaderboard.topPlayers.models @@ -20,4 +20,5 @@ div#columns.row td.name-col-cell= session.get('creatorName') || "Anonymous" td a(href="/play/level/#{level.get('slug') || level.id}/?team=#{team.otherTeam}&opponent=#{session.id}") - span Battle as #{team.otherTeam}! \ No newline at end of file + span(data-i18n="ladder.battle_as") Battle as + | #{team.otherTeam}! \ No newline at end of file From ca271fedd6098fb4b1cf9616bc533bef769f45b7 Mon Sep 17 00:00:00 2001 From: Ruben Vereecken Date: Wed, 12 Mar 2014 21:13:01 +0100 Subject: [PATCH 05/11] Added i18n to my matches tab --- app/locale/en.coffee | 24 ++++++++++- app/templates/play/ladder/my_matches_tab.jade | 42 +++++++++++-------- 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/app/locale/en.coffee b/app/locale/en.coffee index 8812de23b..78b1c3a87 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -1,4 +1,5 @@ -module.exports = nativeDescription: "English", englishDescription: "English", translation: +module.exports = + nativeDescription: "English", englishDescription: "English", translation: common: loading: "Loading..." saving: "Saving..." @@ -276,6 +277,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr commit_msg: "Commit Message" history: "History" version_history_for: "Version History for: " + result: "Result" results: "Results" description: "Description" or: "or" @@ -284,6 +286,11 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr message: "Message" code: "Code" ladder: "Ladder" + opponent: "Opponent" + when: "When" + win: "Win" + loss: "Loss" + tie: "Tie" about: who_is_codecombat: "Who is CodeCombat?" @@ -488,4 +495,17 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr rank: "Rank" score: "Score" leaderboard: "Leaderboard" - battle_as: "Battle as" \ No newline at end of file + battle_as: "Battle as" + summary_your: "Your " + summary_matches: "Matches - " + summary_wins: " Wins, " + summary_losses: " Losses" + rank_no_code: "No New Code to Rank" + rank_my_game: "Rank My Game!" + rank_submitting: "Submitting..." + rank_submitted: "Submitted for Ranking" + rank_failed: "Failed to Rank" + rank_being_ranked: "Game Being Ranked" + code_being_simulated: "Your new code is being simulated by other players for ranking. This will refresh as new matches come in." + no_ranked_matches_pre: "No ranked matches for the " + no_ranked_matches_post: " team! Play against some competitors and then come back here to get your game ranked." \ No newline at end of file diff --git a/app/templates/play/ladder/my_matches_tab.jade b/app/templates/play/ladder/my_matches_tab.jade index b9cf618a2..0ca1f26a1 100644 --- a/app/templates/play/ladder/my_matches_tab.jade +++ b/app/templates/play/ladder/my_matches_tab.jade @@ -11,16 +11,22 @@ div#columns.row tr th(colspan=4, style="color: #{team.primaryColor}") - span Your #{team.name} Matches - #{team.wins} Wins, #{team.losses} Losses + span(data-i18n="ladder.summary_your") Your + |#{team.name} + span(data-i18n="ladder.summary_matches") Matches - + |#{team.wins} + span(data-i18n="ladder.summary_wins") Wins, + |#{team.losses} + span(data-i18n="ladder.summary_losses") Losses if team.session button.btn.btn-sm.btn-warning.pull-right.rank-button(data-session-id=team.session.id) - span.unavailable.hidden No New Code to Rank - span.rank.hidden Rank My Game! - span.submitting.hidden Submitting... - span.submitted.hidden Submitted for Ranking - span.failed.hidden Failed to Rank - span.ranking.hidden Game Being Ranked + span(data-i18n="ladder.rank_no_code").unavailable.hidden No New Code to Rank + span(data-i18n="ladder.rank_my_game").rank.hidden Rank My Game! + span(data-i18n="ladder.rank_submitting").submitting.hidden Submitting... + span(data-i18n="ladder.rank_submitted").submitted.hidden Submitted for Ranking + span(data-i18n="ladder.rank_failed").failed.hidden Failed to Rank + span(data-i18n="ladder.rank_being_ranked").ranking.hidden Game Being Ranked if team.chartData tr @@ -28,19 +34,19 @@ div#columns.row img(src="https://chart.googleapis.com/chart?chs=450x125&cht=lxy&chco=#{team.chartColor}&chtt=Score%3A+#{team.currentScore}&chts=#{team.chartColor},16,r&chf=a,s,000000FF&chls=2&chm=o,#{team.chartColor},0,4&chd=t:#{team.chartData}") tr - th Result - th Opponent - th When + th(data-i18n="general.result") Result + th(data-i18n="general.opponent") Opponent + th(data-i18n="general.when") When th for match in team.matches tr(class=(match.stale ? "stale " : "") + match.state) td.state-cell if match.state === 'win' - span.win Win + span(data-i18n="general.win").win Win if match.state === 'loss' - span.loss Loss + span(data-i18n="general.loss").loss Loss if match.state === 'tie' - span.tie Tie + span(data-i18n="general.tie").tie Tie td.name-cell= match.opponentName || "Anonymous" td.time-cell= match.when td.battle-cell @@ -51,10 +57,12 @@ div#columns.row tr if team.isRanking td(colspan=4).alert.alert-info - | Your new code is being simulated by other players for ranking. - | This will refresh as new matches come in. + span(data-i18n="ladder.code_being_simulated") + Your new code is being simulated by other players for ranking. + This will refresh as new matches come in. else td(colspan=4).alert.alert-warning - | No ranked matches for the #{team.name} team! - | Play against some competitors and then come back here to get your game ranked. + span(data-i18n="ladder.no_ranked_matches_pre") No ranked matches for the + |#{team.name} + span(data-i18n="ladder.no_ranked_matches_post") team! Play against some competitors and then come back here to get your game ranked. From f4637251bebb3ee11d0205f8b70095a091d7b25a Mon Sep 17 00:00:00 2001 From: Ruben Vereecken Date: Wed, 12 Mar 2014 21:23:25 +0100 Subject: [PATCH 06/11] Added i18n to play modal --- app/locale/en.coffee | 19 +++++++++--- app/templates/play/ladder/my_matches_tab.jade | 6 ++-- app/templates/play/ladder/play_modal.jade | 30 +++++++++---------- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/app/locale/en.coffee b/app/locale/en.coffee index 78b1c3a87..b76dddd08 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -1,5 +1,4 @@ -module.exports = - nativeDescription: "English", englishDescription: "English", translation: +module.exports = nativeDescription: "English", englishDescription: "English", translation: common: loading: "Loading..." saving: "Saving..." @@ -286,11 +285,14 @@ module.exports = message: "Message" code: "Code" ladder: "Ladder" - opponent: "Opponent" when: "When" win: "Win" loss: "Loss" tie: "Tie" + easy: "Easy" + medium: "Medium" + hard: "Hard" + about: who_is_codecombat: "Who is CodeCombat?" @@ -508,4 +510,13 @@ module.exports = rank_being_ranked: "Game Being Ranked" code_being_simulated: "Your new code is being simulated by other players for ranking. This will refresh as new matches come in." no_ranked_matches_pre: "No ranked matches for the " - no_ranked_matches_post: " team! Play against some competitors and then come back here to get your game ranked." \ No newline at end of file + no_ranked_matches_post: " team! Play against some competitors and then come back here to get your game ranked." + choose_opponent: "Choose an Opponent" + tutorial_play: "Play Tutorial" + tutorial_recommended: "Recommended if you've never played before" + tutorial_skip: "Skip Tutorial" + tutorial_not_sure: "Not sure what's going on?" + tutorial_play_first: "Play the tutorial first." + simple_ai: "Simple AI" + warmup: "Warmup" + vs: "VS" diff --git a/app/templates/play/ladder/my_matches_tab.jade b/app/templates/play/ladder/my_matches_tab.jade index 0ca1f26a1..b9cf4d459 100644 --- a/app/templates/play/ladder/my_matches_tab.jade +++ b/app/templates/play/ladder/my_matches_tab.jade @@ -58,11 +58,11 @@ div#columns.row if team.isRanking td(colspan=4).alert.alert-info span(data-i18n="ladder.code_being_simulated") - Your new code is being simulated by other players for ranking. - This will refresh as new matches come in. + | Your new code is being simulated by other players for ranking. + | This will refresh as new matches come in. else td(colspan=4).alert.alert-warning span(data-i18n="ladder.no_ranked_matches_pre") No ranked matches for the - |#{team.name} + | #{team.name} span(data-i18n="ladder.no_ranked_matches_post") team! Play against some competitors and then come back here to get your game ranked. diff --git a/app/templates/play/ladder/play_modal.jade b/app/templates/play/ladder/play_modal.jade index 25d492b6f..72cc45267 100644 --- a/app/templates/play/ladder/play_modal.jade +++ b/app/templates/play/ladder/play_modal.jade @@ -1,23 +1,23 @@ extends /templates/modal/modal_base block modal-header-content - h3 Choose an Opponent + h3(data-i18n="ladder.choose_opponent") Choose an Opponent block modal-body-content div#noob-view.secret a(href="/play/level/#{levelID}-tutorial").btn.btn-success.btn-block.btn-lg p - strong Play Tutorial - span Recommended if you've never played before - span.btn.btn-primary.btn-block.btn-lg#skip-tutorial-button Skip Tutorial + strong(data-i18n="ladder.tutorial_play") Play Tutorial + span(data-i18n="ladder.tutorial_recommended") Recommended if you've never played before + span.btn.btn-primary.btn-block.btn-lg#skip-tutorial-button(data-i18n="ladder.tutorial_skip") Skip Tutorial div#normal-view p.tutorial-suggestion - strong Not sure what's going on? + strong(data-i18n="ladder.tutorial_not_sure") Not sure what's going on? | - a(href="/play/level/#{levelID}-tutorial") Play the tutorial first. + a(href="/play/level/#{levelID}-tutorial", data-i18n="ladder.tutorial_play_first") Play the tutorial first. a(href="/play/level/#{levelID}?team=#{teamID}") div.play-option @@ -28,10 +28,10 @@ block modal-body-content div.my-name.name-label.only-one span= myName div.opponent-name.name-label - span Simple AI + span(data-i18n="ladder.simple_ai") Simple AI div.difficulty - span Warmup - div.vs VS + span(data-i18n="ladder.warmup") Warmup + div(data-i18n="ladder.vs").vs VS if challengers.easy a(href="/play/level/#{levelID}?team=#{teamID}&opponent=#{challengers.easy.sessionID}") @@ -45,8 +45,8 @@ block modal-body-content div.opponent-name.name-label span= challengers.easy.opponentName div.difficulty - span Easy - div.vs VS + span(data-i18n="general.easy") Easy + div(data-i18n="ladder.vs").vs VS if challengers.medium a(href="/play/level/#{levelID}?team=#{teamID}&opponent=#{challengers.medium.sessionID}") @@ -60,8 +60,8 @@ block modal-body-content div.opponent-name.name-label span= challengers.medium.opponentName div.difficulty - span Medium - div.vs VS + span(data-i18n="general.medium") Medium + div(data-i18n="ladder.vs").vs VS if challengers.hard a(href="/play/level/#{levelID}?team=#{teamID}&opponent=#{challengers.hard.sessionID}") @@ -75,7 +75,7 @@ block modal-body-content div.opponent-name.name-label span= challengers.hard.opponentName div.difficulty - span Hard - div.vs VS + span(data-i18n="general.hard") Hard + div(data-i18n="ladder.vs").vs VS block modal-footer \ No newline at end of file From b845961218604c6025c472d8949a4ab2bd94cf66 Mon Sep 17 00:00:00 2001 From: Ruben Vereecken Date: Wed, 12 Mar 2014 21:25:14 +0100 Subject: [PATCH 07/11] Clean up --- app/locale/en.coffee | 4 ++-- app/templates/play/ladder/ladder_tab.jade | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/locale/en.coffee b/app/locale/en.coffee index b76dddd08..34bbea38a 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -286,6 +286,8 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr code: "Code" ladder: "Ladder" when: "When" + rank: "Rank" + score: "Score" win: "Win" loss: "Loss" tie: "Tie" @@ -494,8 +496,6 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr simulation_explanation: "By simulating games you can get your game ranked faster!" simulate_games: "Simulate Games!" simulate_all: "RESET AND SIMULATE GAMES" - rank: "Rank" - score: "Score" leaderboard: "Leaderboard" battle_as: "Battle as" summary_your: "Your " diff --git a/app/templates/play/ladder/ladder_tab.jade b/app/templates/play/ladder/ladder_tab.jade index ba6de50b3..141979920 100644 --- a/app/templates/play/ladder/ladder_tab.jade +++ b/app/templates/play/ladder/ladder_tab.jade @@ -7,8 +7,8 @@ div#columns.row span= team.name span(data-i18n="ladder.leaderboard") Leaderboard tr - th(data-i18n="ladder.rank") Rank - th(data-i18n="ladder.score") Score + th(data-i18n="general.rank") Rank + th(data-i18n="general.score") Score th(data-i18n="general.name").name-col-cell Name th From 6d3525afe6a3428e03e321f4cfc2e9c0fa297fc6 Mon Sep 17 00:00:00 2001 From: Ruben Vereecken Date: Wed, 12 Mar 2014 21:47:10 +0100 Subject: [PATCH 08/11] Finished NL translations for ladder --- app/locale/en.coffee | 4 ++-- app/locale/nl.coffee | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/app/locale/en.coffee b/app/locale/en.coffee index 34bbea38a..37b209b8f 100644 --- a/app/locale/en.coffee +++ b/app/locale/en.coffee @@ -497,7 +497,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr simulate_games: "Simulate Games!" simulate_all: "RESET AND SIMULATE GAMES" leaderboard: "Leaderboard" - battle_as: "Battle as" + battle_as: "Battle as " summary_your: "Your " summary_matches: "Matches - " summary_wins: " Wins, " @@ -516,7 +516,7 @@ module.exports = nativeDescription: "English", englishDescription: "English", tr tutorial_recommended: "Recommended if you've never played before" tutorial_skip: "Skip Tutorial" tutorial_not_sure: "Not sure what's going on?" - tutorial_play_first: "Play the tutorial first." + tutorial_play_first: "Play the Tutorial first." simple_ai: "Simple AI" warmup: "Warmup" vs: "VS" diff --git a/app/locale/nl.coffee b/app/locale/nl.coffee index 199315d9c..aef80d8f9 100644 --- a/app/locale/nl.coffee +++ b/app/locale/nl.coffee @@ -269,12 +269,23 @@ module.exports = nativeDescription: "Nederlands", englishDescription: "Dutch", t commit_msg: "Commit Bericht" history: "Geschiedenis" version_history_for: "Versie geschiedenis voor: " + result: "Resultaat" results: "Resultaten" description: "Beschrijving" or: "of" email: "Email" message: "Bericht" code: "Code" + ladder: "Ladder" + when: "Wanneer" + rank: "Rang" + score: "Score" + win: "Win" + loss: "Verlies" + tie: "Gelijk" + easy: "Gemakkelijk" + medium: "Medium" + hard: "Moeilijk" about: who_is_codecombat: "Wie is CodeCombat?" @@ -468,3 +479,35 @@ module.exports = nativeDescription: "Nederlands", englishDescription: "Dutch", t ambassador_title_description: "(Ondersteuning)" counselor_title: "Raadgever" counselor_title_description: "(Expert/Leraar)" + + ladder: + please_login: "Log alstublieft eerst in voordat u een ladderspel speelt." + my_matches: "Mijn Wedstrijden" + simulate: "Simuleer" + simulation_explanation: "Door spellen te simuleren kan je zelf sneller beoordeeld worden!" + simulate_games: "Simuleer spellen!" + simulate_all: "RESET EN SIMULEER SPELLEN" + leaderboard: "Leaderboard" + battle_as: "Vecht als " + summary_your: "Jouw " + summary_matches: "Wedstrijden - " + summary_wins: " Overwinningen, " + summary_losses: " Nederlagen" + rank_no_code: "Geen nieuwe code om te Beoordelen!" + rank_my_game: "Beoordeel mijn spel!" + rank_submitting: "Verzenden..." + rank_submitted: "Verzonden voor Beoordeling" + rank_failed: "Beoordeling mislukt" + rank_being_ranked: "Spel wordt Beoordeeld" + code_being_simulated: "Uw nieuwe code wordt gesimuleerd door andere spelers om te beoordelen. Dit wordt vernieuwd zodra nieuwe matches binnenkomen." + no_ranked_matches_pre: "Geen beoordeelde wedstrijden voor het" + no_ranked_matches_post: " team! Speel tegen enkele tegenstanders en kom terug hier om uw spel te laten beoordelen." + choose_opponent: "Kies een tegenstander" + tutorial_play: "Speel de Tutorial" + tutorial_recommended: "Aanbevolen als je nog niet eerder hebt gespeeld" + tutorial_skip: "Sla Tutorial over" + tutorial_not_sure: "Niet zeker wat er aan de gang is?" + tutorial_play_first: "Speel eerst de Tutorial." + simple_ai: "Simpele AI" + warmup: "Opwarming" + vs: "tegen" From 19184a88b09893f5a8483f271558fa37d01acfb4 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Wed, 12 Mar 2014 13:49:28 -0700 Subject: [PATCH 09/11] Fixed showing the guide at the beginning of the level.... more. --- app/views/play/level_view.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/play/level_view.coffee b/app/views/play/level_view.coffee index 5f37798a3..1282297ba 100644 --- a/app/views/play/level_view.coffee +++ b/app/views/play/level_view.coffee @@ -128,6 +128,7 @@ module.exports = class PlayLevelView extends View onLevelLoaderProgressChanged: -> return if @seenDocs + return unless @levelLoader.session.loaded and @levelLoader.level.loaded return unless showFrequency = @levelLoader.level.get('showsGuide') session = @levelLoader.session diff = new Date().getTime() - new Date(session.get('created')).getTime() From 68c51448387b828b05b42026cf23f1fda8cd13d4 Mon Sep 17 00:00:00 2001 From: Scott Erickson Date: Wed, 12 Mar 2014 13:49:36 -0700 Subject: [PATCH 10/11] Added AoE circles. --- app/lib/surface/CocoSprite.coffee | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/app/lib/surface/CocoSprite.coffee b/app/lib/surface/CocoSprite.coffee index 131839b27..33860e1c0 100644 --- a/app/lib/surface/CocoSprite.coffee +++ b/app/lib/surface/CocoSprite.coffee @@ -62,6 +62,7 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass @actionQueue = [] @marks = {} @labels = {} + @handledAoEs = {} @age = 0 @displayObject = new createjs.Container() if @thangType.get('actions') @@ -178,9 +179,35 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass @updateAction() @updateStats() @updateGold() + @showAreaOfEffects() @updateMarks() @updateLabels() + showAreaOfEffects: -> + return unless @thang?.currentEvents + for event in @thang.currentEvents + continue unless event.startsWith 'aoe-' + continue if @handledAoEs[event] + + @handledAoEs[event] = true + args = JSON.parse(event[4...]) + pos = @options.camera.worldToSurface {x:args[0], y:args[1]} + circle = new createjs.Shape() + circle.graphics.beginFill(args[3]).drawCircle(0, 0, args[2]*Camera.PPM) + circle.x = pos.x + circle.y = pos.y + circle.scaleY = @options.camera.y2x * 0.7 + circle.scaleX = 0.7 + circle.alpha = 0.2 + circle + @options.groundLayer.addChild circle + createjs.Tween.get(circle) + .to({alpha: 0.6, scaleY: @options.camera.y2x, scaleX: 1}, 100, createjs.Ease.circOut) + .to({alpha: 0, scaleY: 0, scaleX: 0}, 700, createjs.Ease.circIn) + .call => + @options.groundLayer.removeChild circle + delete @handledAoEs[event] + cache: -> bounds = @imageObject.getBounds() @displayObject.cache 0, 0, bounds.width, bounds.height From 8c7c49fdbb20ec00e57741f9b0e50dc2b0f1ae3a Mon Sep 17 00:00:00 2001 From: Ruben Vereecken Date: Wed, 12 Mar 2014 21:54:54 +0100 Subject: [PATCH 11/11] Reverted work done on wrong branch --- app/lib/utils.coffee | 22 ----------------- test/app/lib/utils.spec.coffee | 43 ---------------------------------- 2 files changed, 65 deletions(-) delete mode 100644 test/app/lib/utils.spec.coffee diff --git a/app/lib/utils.coffee b/app/lib/utils.coffee index 29f1434f2..96a74599b 100644 --- a/app/lib/utils.coffee +++ b/app/lib/utils.coffee @@ -45,25 +45,3 @@ toHex = (n) -> h = Math.floor(n).toString(16) h = '0'+h if h.length is 1 h - -i18n = (say, target, language=me.lang(), fallback='en') -> - generalResult = null - fallbackResult = null - fallforwardResult = null # If a general language isn't available, the first specific one will do - matches = (/\w+/gi).exec(language) - generalName = matches[0] if matches - - for locale in say?.i18n - if target of say[locale] - result = say[locale][target] - else continue - return result if locale == language - generalResult = result if locale == generalName - fallbackResult = result if locale == fallback - fallforwardResult = result if locale.indexOf language != -1 and not fallforwardResult? - - return generalResult if generalResult? - return fallbackResult if fallbackResult? - return fallforwardResult if fallforwardResult? - return say.text if 'text' of say - null \ No newline at end of file diff --git a/test/app/lib/utils.spec.coffee b/test/app/lib/utils.spec.coffee deleted file mode 100644 index d729517a0..000000000 --- a/test/app/lib/utils.spec.coffee +++ /dev/null @@ -1,43 +0,0 @@ -describe 'utils library', -> - require 'lib/utils' - - beforeEach -> - fixture1 = { - "text": "G'day, Wizard! Come to practice? Well, let's get started...", - "i18n": { - "es-419": { - "text": "¡Buenas, Hechicero! ¿Vienes a practicar? Bueno, empecemos..." - }, - "es-ES": { - "text": "¡Buenas Mago! ¿Vienes a practicar? Bien, empecemos..." - }, - "es": { - "text": "¡Buenas Mago! ¿Vienes a practicar? Muy bien, empecemos..." - }, - "fr": { - "text": "S'lut, Magicien! Venu pratiquer? Ok, bien débutons..." - }, - "pt-BR": { - "text": "Bom dia, feiticeiro! Veio praticar? Então vamos começar..." - }, - "de": { - "text": "'N Tach auch, Zauberer! Kommst Du zum Üben? Dann lass uns anfangen..." - }, - "tr": { - "text": "İyi günler, Büyücü! Antremana mı geldin? Güzel, hadi başlayalım..." - }, - "sv": { - "text": "Godagens, trollkarl! Kommit för att öva? Nå, låt oss börja..." - }, - "en": { - "text": "Ohai Magician!" - } - }, - "sound": { - "mp3": "db/level/52740644904ac0411700067c/gday_wizard_come_to_practice.mp3", - "ogg": "db/level/52740644904ac0411700067c/gday_wizard_come_to_practice.ogg" - } - } - - it 'i18n should find a valid target string', -> - expect(i18n(fixture1, 'text', 'en')).toEqual(fixture1.i18n.en.text)