Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add language dropdown #1606

Merged
merged 66 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
c8920c4
feat: add language dropdown
evemartin Apr 24, 2024
dd2a149
feat: improve language dropdown
evemartin Apr 25, 2024
8be1d3f
feat: add language dropdown test
evemartin Apr 25, 2024
f85ef27
remove test file to debug
evemartin Apr 25, 2024
c3e8198
debug tests
evemartin Apr 25, 2024
e66876a
debug tests
evemartin Apr 25, 2024
9d1d944
debug tests
evemartin Apr 25, 2024
eb25d9b
debug tests
evemartin Apr 25, 2024
cae1170
debug tests
evemartin Apr 25, 2024
5aea941
debug tests
evemartin Apr 25, 2024
83787a5
debug tests
evemartin Apr 25, 2024
348762a
Simplify callback
faucomte97 Apr 25, 2024
973189f
Merge
faucomte97 Apr 25, 2024
230a82d
debug tests
evemartin Apr 25, 2024
1c3a124
debug tests
evemartin Apr 25, 2024
0a0ce27
testing
evemartin Apr 26, 2024
1295f1f
testing
evemartin Apr 26, 2024
87c74d6
debug tests
evemartin Apr 26, 2024
f85daba
debug tests
evemartin Apr 26, 2024
c6026cf
add dropdown with dummy onchange function
evemartin Apr 26, 2024
732ee68
add loadLanguage functions for updating language
evemartin Apr 26, 2024
301bddc
add other languages
evemartin Apr 26, 2024
7a932aa
debug tests
evemartin Apr 26, 2024
5cda0dd
added loadLanguages file to html
evemartin Apr 26, 2024
0746fd6
test removal of Blockly.Msg references
evemartin Apr 26, 2024
358046b
test addition of en.js script tag
evemartin Apr 26, 2024
a770784
test removal of custom block labels
evemartin Apr 26, 2024
f352c87
test removal of extra css
evemartin Apr 26, 2024
5f9c9c5
debug tests, remove css
evemartin Apr 26, 2024
c134e22
add back removed things except for css
evemartin Apr 26, 2024
fb56ff0
test addition of en.js tag
evemartin Apr 26, 2024
8be873d
test removal of custom block labels
evemartin Apr 26, 2024
8e0f9a2
testing addition of loadLanguage at startup, removal of en.js script
evemartin Apr 26, 2024
9e3a412
test addition of en.js script
evemartin Apr 26, 2024
05de185
testing small changes
evemartin Apr 26, 2024
0e0e971
test reloading workspace instead of containing everything in callback
evemartin Apr 26, 2024
1210dc7
test if reloading the workspace works if nothing else happens
evemartin Apr 26, 2024
e7721a4
more tests to see if just reloading will work
evemartin Apr 26, 2024
778b91a
debug tests, reload
evemartin Apr 26, 2024
76ce255
add back what I changed
evemartin Apr 26, 2024
d47b9f5
removing any reloading
evemartin Apr 26, 2024
8bc3be8
testing out reload again
evemartin Apr 26, 2024
4be15f9
testing if navigator is causing bug
evemartin Apr 26, 2024
2e4c9e6
try calling loadLanguage without reloading
evemartin Apr 26, 2024
ea07969
adding some logging
evemartin Apr 26, 2024
3e6a3a3
moving loadLanguage function
evemartin Apr 26, 2024
a54c20a
try moving function again
evemartin Apr 26, 2024
dc12131
fix logic negate error
evemartin Apr 26, 2024
0794ada
add back other things now that logic negate issue fixed
evemartin Apr 29, 2024
5d53fc1
add back some removed css
evemartin Apr 29, 2024
b7ace27
update css and some text
evemartin Apr 29, 2024
f82449c
merge in testing
evemartin Apr 29, 2024
ad176ed
test removing test
evemartin Apr 29, 2024
185d315
debug tests
evemartin Apr 29, 2024
5907fab
debug tests
evemartin Apr 29, 2024
6b67a5b
debug tests
evemartin Apr 29, 2024
d1afd62
Merge branch 'master' into feat--add-language-dropdown
faucomte97 Apr 29, 2024
afa9cae
address PR comments
evemartin May 1, 2024
7d3218a
address PR comment - show dropdown symbol on language dropdown
evemartin May 1, 2024
cf02c4b
begin adding translations
evemartin May 7, 2024
5a2f248
add black to pipfile
evemartin May 7, 2024
72ca56e
add remaining translations
evemartin May 7, 2024
c34c130
comment out untranslated languages
evemartin May 7, 2024
99d08fb
add hindi
evemartin May 7, 2024
b8020bb
Merge branch 'master' into feat--add-language-dropdown
evemartin May 8, 2024
4bff6e0
address PR comments
evemartin May 8, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ ipython = "*"
rapid-router = {path = ".", editable = true}

[dev-packages]
black = "*"
codeforlife-portal = "*"
django-import-export = "*"
django-selenium-clean = "==1.0.0"
django-test-migrations = "==1.2.0"
importlib-metadata = "<5" # Using version 5 causes an issue when trying to run pytest. Not sure why, linked to: https://stackoverflow.com/questions/73929564/entrypoints-object-has-no-attribute-get-digital-ocean
isort = "*"
pytest = "==7.*"
pytest-django = "==4.5.2"
pytest-order = "*"
Expand Down
81 changes: 76 additions & 5 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions game/end_to_end_tests/base_game_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,12 @@ def go_to_homepage(self):
def go_to_level(self, level_name):
path = reverse("play_default_level", kwargs={"levelName": str(level_name)})
self._go_to_path(path)
self.selenium.execute_script("ocargo.animation.FAST_ANIMATION_DURATION = 1;")

return GamePage(self.selenium)

def go_to_custom_level(self, level):
path = reverse("play_custom_level", kwargs={"levelId": str(level.id)})
self._go_to_path(path)
self.selenium.execute_script("ocargo.animation.FAST_ANIMATION_DURATION = 1;")

return GamePage(self.selenium)

Expand All @@ -106,7 +104,6 @@ def go_to_level_editor(self):
def go_to_episode(self, episodeId):
path = reverse("start_episode", kwargs={"episodeId": str(episodeId)})
self._go_to_path(path)
self.selenium.execute_script("ocargo.animation.FAST_ANIMATION_DURATION = 1;")

return GamePage(self.selenium)

Expand Down
2 changes: 2 additions & 0 deletions game/end_to_end_tests/game_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class GamePage(BasePage):
def __init__(self, browser):
super(GamePage, self).__init__(browser)

self.browser.execute_script("ocargo.animation.FAST_ANIMATION_DURATION = 1;")

assert self.on_correct_page("game_page")

self._dismiss_initial_dialog()
Expand Down
14 changes: 14 additions & 0 deletions game/end_to_end_tests/test_language_dropdown.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from game.end_to_end_tests.base_game_test import BaseGameTest

from selenium.webdriver.common.by import By

class TestLanguageDropdown(BaseGameTest):
def test_level_language_dropdown(self):
page = self.go_to_level(1)
assert page.element_exists_by_id("language_dropdown")

self.selenium.find_element(By.ID, "language_dropdown").click()
self.selenium.find_element(By.ID, "language_dropdown_fr").click()

text_count = len(self.selenium.find_elements(By.XPATH, ("//*[contains(text(),'Move forwards')]")))
assert text_count == 0
18 changes: 9 additions & 9 deletions game/static/game/css/backgrounds.css
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
/* Background colours for episodes and game sidebar */

.bg--easy {
background: #86ae18;
background-color: #86ae18;
}

.bg--medium {
background: #00a3e0;
background-color: #00a3e0;
}

.bg--medium-hard {
background: #008cc1;
background-color: #008cc1;
}

.bg--brainteasers {
background: #c90548;
background-color: #c90548;
}

.bg--hard {
background: #8967d3;
background-color: #8967d3;
}

.bg--advanced {
background: #754fc8;
background-color: #754fc8;
}

.bg--shared-levels {
background: #f6be00;
background-color: #f6be00;
}

.bg--loops {
background: #3F3F3F;
background-color: #3F3F3F;
}

.bg--loops-coming-soon {
background: #CBCBCB;
background-color: #CBCBCB;
}
10 changes: 10 additions & 0 deletions game/static/game/css/game_screen.css
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,16 @@ div.no-print div.tab label {
background: rgba(255, 255, 255, 0.25);
}

.tab select:hover {
background: rgba(255, 255, 255, 0.25);
}

.tab select {
color: black;
border: none;
font-weight: bold;
}

#console {
z-index: 100;
display: flex;
Expand Down
51 changes: 50 additions & 1 deletion game/static/game/js/blockly/msg/js/en-gb.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,4 +433,53 @@ Blockly.Msg["VARIABLES_HUE"] = "330";
Blockly.Msg["TEXTS_HUE"] = "160";
Blockly.Msg["PROCEDURES_HUE"] = "290";
Blockly.Msg["COLOUR_HUE"] = "20";
Blockly.Msg["VARIABLES_DYNAMIC_HUE"] = "310";
Blockly.Msg["VARIABLES_DYNAMIC_HUE"] = "310";

Blockly.Msg["START_TITLE"] = "Start";
Blockly.Msg["START_TOOLTIP"] = "The beginning of the program"
Blockly.Msg["MOVE_FORWARDS_TITLE"] = "move forwards";
Blockly.Msg["MOVE_FORWARDS_TOOLTIP"] = "Move the van forwards";
Blockly.Msg["TURN_LEFT_TITLE"] = "turn left";
Blockly.Msg["TURN_LEFT_TOOLTIP"] = "Turn the van left";
Blockly.Msg["TURN_RIGHT_TITLE"] = "turn right";
Blockly.Msg["TURN_RIGHT_TOOLTIP"] = "Turn the van right";
Blockly.Msg["TURN_AROUND_TITLE"] = "turn around";
Blockly.Msg["TURN_AROUND_TOOLTIP"] = "Turn the van around";

Blockly.Msg["WAIT_TITLE"] = "wait";
Blockly.Msg["WAIT_TOOLTIP"] = "Keep the van stationary";
Blockly.Msg["DELIVER_TITLE"] = "deliver";
Blockly.Msg["DELIVER_TOOLTIP"] = "Deliver the goods from the van";
Blockly.Msg["SOUND_HORN_TITLE"] = "sound horn";
Blockly.Msg["SOUND_HORN_TOOLTIP"] = "Sound the horn to scare away the cows";

Blockly.Msg["ROAD_EXISTS_FORWARD_TITLE"] = "road exists forward";
Blockly.Msg["ROAD_EXISTS_LEFT_TITLE"] = "road exists left";
Blockly.Msg["ROAD_EXISTS_RIGHT_TITLE"] = "road exists right";
Blockly.Msg["TRAFFIC_LIGHT_RED_TITLE"] = "traffic light red";
Blockly.Msg["TRAFFIC_LIGHT_GREEN_TITLE"] = "traffic light green";
Blockly.Msg["DEAD_END_TITLE"] = "is dead end";
Blockly.Msg["AT_DESTINATION_TITLE"] = "at destination";
Blockly.Msg["COW_CROSSING_TITLE"] = "cows";

Blockly.Msg["CALL_PROC_TITLE"] = "Call";
Blockly.Msg["CALL_PROC_TOOLTIP"] = "Calls a procedure";
Blockly.Msg["DECLARE_PROC_TITLE"] = "Define";
Blockly.Msg["DECLARE_PROC_TOOLTIP"] = "Declares a procedure";
Blockly.Msg["CONTROLS_REPEAT_WHILE_TITLE"] = "repeat while";
Blockly.Msg["CONTROLS_REPEAT_WHILE_SUBTITLE"] = "do";
Blockly.Msg["CONTROLS_REPEAT_WHILE_TOOLTIP"] = "While a value is true, do some statements";
Blockly.Msg["CONTROLS_REPEAT_UNTIL_TITLE"] = "repeat until";
Blockly.Msg["CONTROLS_REPEAT_UNTIL_SUBTITLE"] = "do";
Blockly.Msg["CONTROLS_REPEAT_UNTIL_TOOLTIP"] = "Until a value is true, do some statements";

Blockly.Msg["VARIABLES_GET_TOOLTIP"] = "A variable";
Blockly.Msg["VARIABLES_SET_TITLE"] = "set";
Blockly.Msg["VARIABLES_SET_SUBTITLE"] = "to";
Blockly.Msg["VARIABLES_SET_TOOLTIP"] = "Set a variable";
Blockly.Msg["VARIABLES_NUMERIC_SET_TOOLTIP"] = "Set a variable to a number";
Blockly.Msg["VARIABLES_INCREMENT_TITLE"] = "increment";
Blockly.Msg["VARIABLES_INCREMENT_SUBTITLE"] = "by";
Blockly.Msg["VARIABLES_INCREMENT_TOOLTIP"] = "Increment a variable";
Blockly.Msg["NUMBER_TITLE"] = "Number";
Blockly.Msg["NUMBER_TOOLTIP"] = "A number";
Loading
Loading