Commit 5d693ed5 authored by Matthew Taylor's avatar Matthew Taylor

Add `/info/cards/` route

Also implements a method for handling translation of static files as described in https://github.com/LLK/scratch-www/issues/372#issuecomment-193350144
parent cc457aed
......@@ -42,6 +42,7 @@ var path = require('path');
var languages = require('../languages.json');
var localeCompare = require('./lib/locale-compare');
var localizedUrls = require('./lib/localized-urls');
// -----------------------------------------------------------------------------
// Main script
......@@ -92,6 +93,28 @@ files.forEach(function (file) {
localeCompare.getIdsForView(view, file, viewLocales, idsWithICU, icuWithIds);
});
// get asset url translations
var localizedAssetUrls = {};
files = glob.sync(path.resolve(__dirname, '../src/views/**/l10n-static.json'));
files.forEach(function (file) {
var dirPath = file.split('/');
dirPath.pop();
var view = dirPath.pop();
localizedAssetUrls[view] = {};
var assetUrls = JSON.parse(fs.readFileSync(file, 'utf8'));
for (var lang in localizedUrls) {
localizedAssetUrls[view][lang] = {};
for (var key in assetUrls) {
if (localizedUrls[lang].hasOwnProperty(key)) {
localizedAssetUrls[view][lang][key] = localizedUrls[lang][key];
} else {
localizedAssetUrls[view][lang][key] = assetUrls[key];
}
}
}
});
// md5 of english strings with message key as the value for searching po files.
// Sample structure: { 'sdfas43534sdfasdf': 'general-general.blah', 'lkjfasdf4t342asdfa': 'about-about.blah' }
var md5WithIds = localeCompare.getMD5Map(icuWithIds);
......@@ -110,5 +133,8 @@ for (i in views) {
if (views[i] in viewLocales) {
viewTranslations = merge(viewLocales[views[i]], viewTranslations);
}
if (views[i] in localizedAssetUrls) {
viewTranslations = merge(viewTranslations, localizedAssetUrls[[views[i]]]);
}
localeCompare.writeTranslationsToJS(outputDir, views[i], viewTranslations);
}
This diff is collapsed.
......@@ -24,6 +24,11 @@
"view": "credits",
"title": "Credits"
},
{
"pattern": "/info/cards",
"view": "cards",
"title": "Cards"
},
{
"pattern": "/jobs",
"view": "jobs",
......
This diff is collapsed.
@import "../../colors";
@import "../../typography";
.intro {
display: flex;
margin: 1em 0;
align-items: center;
justify-content: center;
.intro-content {
float: left;
width: 45%;
}
img {
width: 45%;
}
}
.cards-container {
text-align: center;
.box-content {
div {
display: inline-block;
margin: 0 .75em;
max-width: 25%;
a {
display: block;
.pdf-icon {
margin-right: .2em;
width: 1em;
}
}
}
}
}
{
"cards.allCardsLink": "//scratch.mit.edu/scratchr2/static/pdfs/help/Scratch2Cards.pdf",
"cards.danceLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/DanceCards.pdf",
"cards.danceLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/DanceCards.pdf",
"cards.danceThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-dance-thumb.png",
"cards.nameLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/AnimateYourNameCards.pdf",
"cards.nameThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-animateyourname-thumb.png",
"cards.hideLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/Hide-and-Seek-Cards.pdf",
"cards.hideThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-hideandseek-thumb.png",
"cards.changeColorLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/01_v2_ChangeColor.pdf",
"cards.changeColorThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-changecolor-thumb.png",
"cards.moveToBeatLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/02_v2_MovetoaBeat.pdf",
"cards.moveToBeatThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-movetoabeat-thumb.png",
"cards.keyMovesLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/03_v2_KeyMoves.pdf",
"cards.keyMovesThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-keymoves-thumb.png",
"cards.saySomethingLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/04_v2_SaySomething.pdf",
"cards.saySomethingThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-saysomething-thumb.png",
"cards.glideLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/05_v2_Glide.pdf",
"cards.glideThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-glide-thumb.png",
"cards.followMouseLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/06_v2_FollowtheMouse.pdf",
"cards.followMouseThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-followthemouse-thumb.png",
"cards.danceTwistLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/07_v2_DanceTwist.pdf",
"cards.danceTwistThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-dancetwist-thumb.png",
"cards.whirlLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/08_v2_InteractiveWhirl.pdf",
"cards.whirlThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-interactivewhirl-thumb.png",
"cards.animateItLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/09_v2_AnimateIt.pdf",
"cards.animateItThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-animateit-thumb.png ",
"cards.movingAnimationLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/10_v2_MovingAnimation.pdf",
"cards.movingAnimationThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-movinganimation-thumb.png",
"cards.surpriseButtonLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/11_v2_SurpriseButton.pdf",
"cards.surpriseButtonThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-surprisebutton-thumb.png",
"cards.keepScoreLink": "//cdn.scratch.mit.edu/scratchr2/static/pdfs/help/12_v2_KeepScore.pdf",
"cards.keepScoreThumb": "//cdn.scratch.mit.edu/scratchr2/static/images/help/card-keepscore-thumb.png"
}
\ No newline at end of file
{
"cards.introHeader": "Scratch Cards",
"cards.introContent": "Scratch cards provide a quick way to learn new Scratch code.",
"cards.introAllCards": "Get all the Cards",
"cards.introAllCardsEnglish": "English",
"cards.introWikiSupport": "Looking for Scratch Cards in your language? Check <a href=\"http://wiki.scratch.mit.edu/wiki/Scratch_Support_Materials\">Scratch Wiki</a>.",
"cards.viewCard": "View Card",
"cards.dance": "Dance, Dance, Dance",
"cards.name": "Animate Your Name",
"cards.hide": "Hide and Seek",
"cards.changeColor": "Change Color",
"cards.moveToBeat": "Move to a Beat",
"cards.keyMoves": "Key Moves",
"cards.saySomething": "Say Something",
"cards.glide": "Glide",
"cards.followMouse": "Follow the Mouse",
"cards.danceTwist": "Dance Twist",
"cards.whirl": "Interactive Whirl",
"cards.animateIt": "Animate It",
"cards.movingAnimation": "Moving Animation",
"cards.surpriseButton": "Surprise Button",
"cards.keepScore": "Keep Score"
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 19.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="20px" height="20px" viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve">
<g>
<g>
<path style="fill:#41ABE1;" d="M11.8,2.2L16.6,7v0L11.8,2.2z"/>
<path style="fill:#41ABE1;" d="M16.8,7.3c0-0.1-0.1-0.2-0.1-0.3c0,0,0,0,0,0l-4.8-4.8C11.7,2.1,11.6,2,11.4,2H7.1
C5.9,2,4.8,3.1,4.8,4.4v4.4c0,0.4,0.3,0.6,0.6,0.6C5.8,9.4,6,9.2,6,8.8V4.4c0-0.6,0.5-1.1,1.1-1.1h3.6v2.4C10.8,7,11.8,8,13.1,8
h2.4v7.6c0,0.6-0.5,1.1-1.1,1.1H7.1c-0.5,0-0.8-0.3-1-0.7c-0.1-0.2-0.3-0.4-0.5-0.4H5.5c-0.4,0-0.7,0.4-0.6,0.8
C5.3,17.4,6.2,18,7.1,18h7.3c1.3,0,2.4-1.1,2.4-2.4V7.4C16.8,7.4,16.8,7.3,16.8,7.3z M13.1,6.8c-0.6,0-1.1-0.5-1.1-1.1V4.1
l2.6,2.6H13.1z"/>
</g>
<g>
<path style="fill:#41ABE1;" d="M3.2,10.9h1.5c0.9,0,1.4,0.5,1.4,1.2v0c0,0.8-0.6,1.2-1.5,1.2H4.2v1h-1V10.9z M4.6,12.6
c0.3,0,0.6-0.2,0.6-0.5v0c0-0.3-0.2-0.5-0.6-0.5H4.2v0.9H4.6z"/>
<path style="fill:#41ABE1;" d="M7,10.9h1.3c1.2,0,2,0.7,2,1.7v0c0,1-0.7,1.7-2,1.7H7V10.9z M8.4,13.5c0.6,0,1-0.3,1-0.9v0
c0-0.6-0.4-0.9-1-0.9H8v1.8H8.4z"/>
<path style="fill:#41ABE1;" d="M11.3,10.9h2.8v0.8h-1.8v0.6h1.6v0.8h-1.6v1.2h-1V10.9z"/>
</g>
</g>
</svg>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment