Skip to content

Commit

Permalink
Merge main into subdomains
Browse files Browse the repository at this point in the history
  • Loading branch information
jpelay committed Nov 7, 2024
2 parents 1486492 + 6da2c52 commit 9755651
Show file tree
Hide file tree
Showing 589 changed files with 38,677 additions and 448,999 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,7 @@ file_logger.json
# We submitted a PR to the package, but it's still wating to be approved
# Until then, we can include it in .gitignore
# More info in #4540
foo.txt
foo.txt

# Generated schema json files
*.generated.schema.json
10 changes: 7 additions & 3 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
from flask import (Flask, Response, abort, after_this_request, g, jsonify, make_response,
redirect, request, send_file, url_for,
send_from_directory, session)
from flask_babel import Babel, gettext
from flask_babel import Babel
from website.flask_helpers import gettext_with_fallback as gettext
from website.flask_commonmark import Commonmark
from flask_compress import Compress
from urllib.parse import quote_plus
Expand Down Expand Up @@ -463,6 +464,10 @@ def before_request_https():
Compress(app)
Commonmark(app)

# Explicitly substitute the flask gettext function with our custom definition which uses fallback languages
app.jinja_env.globals.update(_=gettext)


# We don't need to log in offline mode
if utils.is_offline_mode():
parse_logger = s3_logger.NullLogger()
Expand Down Expand Up @@ -2025,7 +2030,7 @@ def view_program(user, id, language="en"):
level=int(result['level']),
code=code),
is_teacher=user['is_teacher'],
class_id=student_customizations['id'],
class_id=student_customizations.get('id'),
next_program_id=next_program_id,
next_classmate_program_id=next_classmate_adventure_id,
**arguments_dict)
Expand Down Expand Up @@ -2395,7 +2400,6 @@ def favicon(language="en"):
@app.route('/index.html')
def main_page(language="en"):
sections = hedyweb.PageTranslations('start').get_page_translations(g.lang)['home-sections']

sections = sections[:]

# Sections have 'title', 'text'
Expand Down
18 changes: 14 additions & 4 deletions build-tools/github/validate-yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,26 @@ echo "------> Validating YAML"
# 'npx pajv validate' just hangs. Running the 'pajv' binary directly without the use of
# 'npx' does work... so we're just going to ¯\_(ツ)_/¯ and do that.

all_schemas=$(find content -name \*.schema.json)
schemas=$(find content -name \*.schema.json)

failures=false

for schema in $all_schemas; do
for schema in $schemas; do
dir=$(dirname $schema)
echo "------> Validating $(basename $dir)"

# The non-generated schema files that have required fields. They should be
# used for 'en.yaml' files. The generated schema files allow all fields to be
# optional, so they should be used to validate the rest of the yaml files.
if [[ $schema == *".generated."* ]]; then
files="*";
echo "------> Validating with optional fields $(basename $dir)/*.yaml"
else
files="en";
echo "------> Validating with required fields $(basename $dir)/en.yaml"
fi

# Run the validator.
if ! check-jsonschema -o text --schemafile $schema $dir/*.yaml > validate.txt; then
if ! check-jsonschema -o text --schemafile $schema $dir/$files.yaml > validate.txt; then
cat validate.txt || true
failures=true
fi
Expand Down
9 changes: 1 addition & 8 deletions content/adventures/adventures.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@
"type": "object",
"additionalProperties": false,
"properties": {
"title": {
"type": "string",
"description": "Short title of the adventure"
},
"subtitle": {
"type": "string",
"description": "Slightly longer introductory description of the adventure"
},
"adventures": {
"type": "object",
"description": "Individual adventures, key/value map",
"additionalProperties": { "$ref": "#/definitions/Adventure" }
}
},
"required": ["adventures"],
"definitions": {
"Adventure": {
"type": "object",
Expand Down
2,690 changes: 66 additions & 2,624 deletions content/adventures/ar.yaml

Large diffs are not rendered by default.

3,282 changes: 88 additions & 3,194 deletions content/adventures/bg.yaml

Large diffs are not rendered by default.

3,160 changes: 21 additions & 3,139 deletions content/adventures/bn.yaml

Large diffs are not rendered by default.

3,021 changes: 120 additions & 2,901 deletions content/adventures/ca.yaml

Large diffs are not rendered by default.

2,962 changes: 49 additions & 2,913 deletions content/adventures/cs.yaml

Large diffs are not rendered by default.

Loading

0 comments on commit 9755651

Please sign in to comment.