Skip to content

Commit

Permalink
Merge branch 'main' into cust_adv_5922
Browse files Browse the repository at this point in the history
  • Loading branch information
boryanagoncharenko authored Jan 9, 2025
2 parents 77a34b1 + 1e13614 commit c97cb58
Show file tree
Hide file tree
Showing 28 changed files with 5,579 additions and 44 deletions.
42 changes: 21 additions & 21 deletions content/adventures/ca.yaml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions content/adventures/ga.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
adventures:
story:
name: Scéal
default_save_name: Scéal
1 change: 1 addition & 0 deletions content/adventures/ml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1,083 changes: 1,083 additions & 0 deletions content/adventures/ta.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions content/client-messages/ga.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions content/client-messages/ml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions content/keywords/ga.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions content/keywords/ml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions content/pages/ga.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions content/pages/ml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
37 changes: 27 additions & 10 deletions content/quizzes/de.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ levels:
question_text: Welche Aussage ist wahr?
mp_choice_options:
- option: Du kannst den `{print}` Befehl benutzen, um Fragen zu stellen.
feedback: Dazu ist frage da
feedback: Dazu ist der `{ask}` Befehl da
- option: Du kannst den `{ask}` Befehl benutzen um eine Antwort auszugeben.
feedback: Das ist nicht richtig
- option: Mit dem `{print}` Befehl kannst du Text erscheinen lassen
feedback: Gut
- option: Mit dem {sleep} Befehl kannst du Text vom Bildschirm entfernen.
- option: Mit dem `{sleep}` Befehl kannst du Text vom Bildschirm entfernen.
feedback: So funktioniert `{sleep}` nicht.
hint: '`{print}` funktioniert genauso wie in Level 1'
2:
Expand Down Expand Up @@ -213,7 +213,7 @@ levels:
question_text: Was wird auf dem Ausgabebildschirm angezeigt, wenn du diesen Code ausführst?
code: |-
Name {is} Hedy
{print} Hi mein Name ist Name!
{print} Hi mein Name ist Name
mp_choice_options:
- option: Hi my name is name
feedback: Der Variablenname wird durch Hedy ersetzt
Expand Down Expand Up @@ -358,7 +358,7 @@ levels:
feedback: '`{ask}` wird verwendet, um Fragen zu stellen'
- option: '`{is}`'
feedback: '`{is}` wird verwendet, um eine Liste zu erstellen'
- option: '`{at}` `{random}`'
- option: '`{at} {random}`'
feedback: Korrekt!
hint: Zufällig bedeutet ohne Plan.
2:
Expand Down Expand Up @@ -1151,9 +1151,7 @@ levels:
question_text: Welches Wort ist falsch im Code?
mp_choice_options:
- option: |-
```
I'm
```
`I'm`
feedback: Das ist richtig!
- option: '`{print}`'
feedback: '`{print}` ist richtig geschrieben'
Expand Down Expand Up @@ -1403,7 +1401,7 @@ levels:
Baby shark
Baby shark
Baby shark
feedback: Was wird wiederholt und was nicht.
feedback: Was wird wiederholt und was nicht?
hint: Was wird wiederholt und was nicht?
4:
question_text: Welche Ausgabe ist richtig?
Expand Down Expand Up @@ -1488,7 +1486,7 @@ levels:
food = {ask} 'What would you like to eat?'
{print} food
```
feedback: Awesome!
feedback: Gut gemacht!
hint: Pay attention to what sould be repeated and what should only be printed once.
7:
question_text: Was stimmt mit diesem Code nicht?
Expand Down Expand Up @@ -2147,7 +2145,7 @@ levels:
{print} 10 - i
```
feedback: Das ist richtig!
hint: Es muss eine Berechnung sein...
hint: Es muss eine Berechnung sein
5:
question_text: Was stimmt mit diesem Code nicht?
mp_choice_options:
Expand Down Expand Up @@ -2903,3 +2901,22 @@ levels:
feedback: Don't forget the quotation marks!
- option: sounds = ['woof', 'moo', 'neigh']
feedback: Great job!
17:
8:
mp_choice_options:
- {}
- {}
- feedback: Gut gemacht!
10:
mp_choice_options:
- {}
- {}
- feedback: Gut gemacht!
3:
mp_choice_options:
- {}
- {}
- feedback: Gut gemacht!
5:
mp_choice_options:
- feedback: Gut gemacht!
1 change: 1 addition & 0 deletions content/quizzes/ga.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions content/quizzes/ml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions content/slides/ga.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions content/slides/ml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions content/workbooks/ga.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 1 addition & 0 deletions content/workbooks/ml.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
54 changes: 54 additions & 0 deletions grammars/keywords-ga.lark
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
_DEFINE: ("define" | "define") _SPACE?
_CALL: ("call" | "call") _SPACE?
_WITH: ("with" | "with") _SPACE?
_DEF: ("def" | "def") _SPACE?
_RETURN: ("return" | "return") _SPACE?
_PRINT: ("print" | "print") _SPACE?
_PLAY: ("play" | "play") _SPACE
_ASK: ("ask" | "ask")
_ECHO: ("echo" | "echo") _SPACE?
_FORWARD: ("forward" | "forward") _SPACE?
_TURN: ("turn" | "turn") _SPACE?
left: ("left" | "left") _SPACE?
right: ("right" | "right") _SPACE?
black: ("black" | "black") _SPACE?
blue: ("blue" | "blue") _SPACE?
brown: ("brown" | "brown") _SPACE?
gray: ("gray" | "gray") _SPACE?
green: ("green" | "green") _SPACE?
orange: ("orange" | "orange") _SPACE?
pink: ("pink" | "pink") _SPACE?
purple: ("purple" | "purple") _SPACE?
red: ("red" | "red") _SPACE?
white: ("white" | "white") _SPACE?
yellow: ("yellow" | "yellow") _SPACE?
_IS: _SPACE ("is" | "is") _SPACE
_STANDALONE_IS: ("is" | "is")
_SLEEP: ("sleep" | "sleep") _SPACE?
_ADD_LIST: ("add" | "add") _SPACE
_TO_LIST: _SPACE? ("to" | "to")
_REMOVE: ("remove" | "remove") _SPACE
_FROM: _SPACE? ("from" | "from")
_AT: _SPACE ("at" | "at") _SPACE
random: ("random" | "random") _SPACE?
_IN: _SPACE ("in" | "in") _SPACE
_NOT_IN: _SPACE ("not in" | "not in") _SPACE
_IF: ("if" | "if") _SPACE
_ELSE: "else" | "else"
_AND: _SPACE? ("and" | "and") _SPACE
_REPEAT: ("repeat" | "repeat") _SPACE
_TIMES: _SPACE ("times" | "times")
_FOR: ("for" | "for") _SPACE
_RANGE: ("range" | "range") _SPACE?
_TO: _SPACE ("to" | "to") _SPACE
_STEP: "step" | "step"
_ELIF: _SPACE? ("elif" | "elif") _SPACE
_INPUT: ("input" | "input")
_OR: _SPACE? ("or" | "or") _SPACE
_WHILE: ("while" | "while") _SPACE
_LENGTH: "length" | "length"
_COLOR : ("color" | "color") _SPACE?
_PRESSED: ("pressed" | "pressed") _SPACE?
clear: ("clear" | "clear") _SPACE?
TRUE: ("true" | "True" | "true" | "True") _SPACE?
FALSE: ("false" | "False" | "false" | "False") _SPACE?
54 changes: 54 additions & 0 deletions grammars/keywords-ml.lark
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
_DEFINE: ("define" | "define") _SPACE?
_CALL: ("call" | "call") _SPACE?
_WITH: ("with" | "with") _SPACE?
_DEF: ("def" | "def") _SPACE?
_RETURN: ("return" | "return") _SPACE?
_PRINT: ("print" | "print") _SPACE?
_PLAY: ("play" | "play") _SPACE
_ASK: ("ask" | "ask")
_ECHO: ("echo" | "echo") _SPACE?
_FORWARD: ("forward" | "forward") _SPACE?
_TURN: ("turn" | "turn") _SPACE?
left: ("left" | "left") _SPACE?
right: ("right" | "right") _SPACE?
black: ("black" | "black") _SPACE?
blue: ("blue" | "blue") _SPACE?
brown: ("brown" | "brown") _SPACE?
gray: ("gray" | "gray") _SPACE?
green: ("green" | "green") _SPACE?
orange: ("orange" | "orange") _SPACE?
pink: ("pink" | "pink") _SPACE?
purple: ("purple" | "purple") _SPACE?
red: ("red" | "red") _SPACE?
white: ("white" | "white") _SPACE?
yellow: ("yellow" | "yellow") _SPACE?
_IS: _SPACE ("is" | "is") _SPACE
_STANDALONE_IS: ("is" | "is")
_SLEEP: ("sleep" | "sleep") _SPACE?
_ADD_LIST: ("add" | "add") _SPACE
_TO_LIST: _SPACE? ("to" | "to")
_REMOVE: ("remove" | "remove") _SPACE
_FROM: _SPACE? ("from" | "from")
_AT: _SPACE ("at" | "at") _SPACE
random: ("random" | "random") _SPACE?
_IN: _SPACE ("in" | "in") _SPACE
_NOT_IN: _SPACE ("not in" | "not in") _SPACE
_IF: ("if" | "if") _SPACE
_ELSE: "else" | "else"
_AND: _SPACE? ("and" | "and") _SPACE
_REPEAT: ("repeat" | "repeat") _SPACE
_TIMES: _SPACE ("times" | "times")
_FOR: ("for" | "for") _SPACE
_RANGE: ("range" | "range") _SPACE?
_TO: _SPACE ("to" | "to") _SPACE
_STEP: "step" | "step"
_ELIF: _SPACE? ("elif" | "elif") _SPACE
_INPUT: ("input" | "input")
_OR: _SPACE? ("or" | "or") _SPACE
_WHILE: ("while" | "while") _SPACE
_LENGTH: "length" | "length"
_COLOR : ("color" | "color") _SPACE?
_PRESSED: ("pressed" | "pressed") _SPACE?
clear: ("clear" | "clear") _SPACE?
TRUE: ("true" | "True" | "true" | "True") _SPACE?
FALSE: ("false" | "False" | "false" | "False") _SPACE?
16 changes: 11 additions & 5 deletions hedy_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,15 @@ def get_commands_for_level(self, level, keyword_lang):


def deep_translate_keywords(yaml, keyword_language):
"""Recurse through a data structure and replace keyword placeholders in any strings we encounter.
It's easy to make content that doesn't replace properly (make typos in the
amounts of `{` for example), and then our entire build stops. So what we'll
do instead is return the original, untranslated string. This makes it
obvious that something is wrong if the content is looked at, while not
stopping the build.
"""
try:
"""Recurse through a data structure and replace keyword placeholders in any strings we encounter."""
if isinstance(yaml, str):
# this is used to localize adventures linked in slides (PR 3860)
yaml = yaml.replace('/raw', f'/raw?keyword_language={keyword_language}')
Expand All @@ -548,10 +555,9 @@ def deep_translate_keywords(yaml, keyword_language):
if isinstance(yaml, dict):
return {k: deep_translate_keywords(v, keyword_language) for k, v in yaml.items()}
return yaml
except ValueError as E:
raise ValueError(f'Issue in language {keyword_language}. Offending yaml: {yaml}. Error: {E}')
except TypeError as E:
raise TypeError(f'Issue in language {keyword_language}. Offending yaml: {yaml}. Error: {E}')
except Exception as E:
logger.exception(f'Issue in language {keyword_language}. Offending yaml: {yaml}. Error: {E}')
return yaml


def get_localized_name(name, keyword_lang):
Expand Down
118 changes: 118 additions & 0 deletions highlighting/highlighting-trad.json
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,65 @@
"yellow": "yellow",
"DIGIT": "0123456789"
},
"ga": {
"False": "False",
"True": "True",
"add": "add",
"and": "and",
"ask": "ask",
"at": "at",
"black": "black",
"blue": "blue",
"brown": "brown",
"call": "call",
"clear": "clear",
"color": "color",
"comma": ",",
"def": "def",
"define": "define",
"echo": "echo",
"elif": "elif",
"else": "else",
"false": "false",
"for": "for",
"forward": "forward",
"from": "from",
"gray": "gray",
"green": "green",
"if": "if",
"in": "in",
"input": "input",
"is": "is",
"left": "left",
"length": "length",
"not_in": "not in",
"or": "or",
"orange": "orange",
"pink": "pink",
"play": "play",
"pressed": "pressed",
"print": "print",
"purple": "purple",
"random": "random",
"range": "range",
"red": "red",
"remove": "remove",
"repeat": "repeat",
"return": "return",
"right": "right",
"sleep": "sleep",
"step": "step",
"times": "times",
"to": "to",
"to_list": "to",
"true": "true",
"turn": "turn",
"while": "while",
"white": "white",
"with": "with",
"yellow": "yellow",
"DIGIT": "0123456789"
},
"he": {
"False": "False",
"True": "True",
Expand Down Expand Up @@ -1828,6 +1887,65 @@
"yellow": "yellow",
"DIGIT": "0123456789"
},
"ml": {
"False": "False",
"True": "True",
"add": "add",
"and": "and",
"ask": "ask",
"at": "at",
"black": "black",
"blue": "blue",
"brown": "brown",
"call": "call",
"clear": "clear",
"color": "color",
"comma": ",",
"def": "def",
"define": "define",
"echo": "echo",
"elif": "elif",
"else": "else",
"false": "false",
"for": "for",
"forward": "forward",
"from": "from",
"gray": "gray",
"green": "green",
"if": "if",
"in": "in",
"input": "input",
"is": "is",
"left": "left",
"length": "length",
"not_in": "not in",
"or": "or",
"orange": "orange",
"pink": "pink",
"play": "play",
"pressed": "pressed",
"print": "print",
"purple": "purple",
"random": "random",
"range": "range",
"red": "red",
"remove": "remove",
"repeat": "repeat",
"return": "return",
"right": "right",
"sleep": "sleep",
"step": "step",
"times": "times",
"to": "to",
"to_list": "to",
"true": "true",
"turn": "turn",
"while": "while",
"white": "white",
"with": "with",
"yellow": "yellow",
"DIGIT": "0123456789"
},
"ms": {
"False": "False",
"True": "True",
Expand Down
Loading

0 comments on commit c97cb58

Please sign in to comment.