Localize homepage row content

This commit is contained in:
Ray Schamp 2015-10-20 14:42:17 -04:00
parent 6259cb5b97
commit 50646b6c3c
2 changed files with 69 additions and 15 deletions

14
en.json
View file

@ -17,6 +17,7 @@
"general.jobs": "Jobs",
"general.joinScratch": "Join Scratch",
"general.legal": "Legal",
"general.learnMore": "Learn More",
"general.messages": "Messages",
"general.myStuff": "My Stuff",
"general.offlineEditor": "Offline Editor",
@ -49,5 +50,16 @@
"parents.FaqAgeRangeA": "While Scratch is primarily designed for 8 to 16 year olds, it is also used by people of all ages, including younger children with their parents.",
"parents.FaqAgeRangeQ": "What is the age range for Scratch?",
"parents.FaqResourcesQ": "What resources are available for learning Scratch?",
"parents.introDescription": "Scratch is a programming language and an online community where children can program and share interactive media such as stories, games, and animation with people from all over the world. As children create with Scratch, they learn to think creatively, work collaboratively, and reason systematically. Scratch is designed and maintained by the Lifelong Kindergarten group at the MIT Media Lab."
"parents.introDescription": "Scratch is a programming language and an online community where children can program and share interactive media such as stories, games, and animation with people from all over the world. As children create with Scratch, they learn to think creatively, work collaboratively, and reason systematically. Scratch is designed and maintained by the Lifelong Kindergarten group at the MIT Media Lab.",
"splash.featuredProjects": "Featured Projects",
"splash.featuredStudios": "Featured Studios",
"splash.projectsCuratedBy": "Projects Curated by",
"splash.scratchDesignStudioTitle": "Scratch Design Studio",
"splash.visitTheStudio": "Visit the studio",
"splash.recentlySharedProjects": "Recently Shared Projects",
"splash.projectsByScratchersFollowing": "Projects by Scratchers I'm Following",
"splash.projectsLovedByScratchersFollowing": "Projects Loved by Scratchers I'm Following",
"splash.projectsInStudiosFollowing": "Projects in Studios I'm Following",
"splash.communityRemixing": "What the Community is Remixing",
"splash.communityLoving": "What the Community is Loving"
}

View file

@ -1,3 +1,4 @@
var injectIntl = require('react-intl').injectIntl;
var React = require('react');
var render = require('../../lib/render.jsx');
@ -14,7 +15,7 @@ var News = require('../../components/news/news.jsx');
require('./splash.scss');
var Splash = React.createClass({
var Splash = injectIntl(React.createClass({
type: 'Splash',
mixins: [
Api,
@ -77,11 +78,20 @@ var Splash = React.createClass({
}.bind(this));
},
renderHomepageRows: function () {
var formatMessage = this.props.intl.formatMessage;
var rows = [
<Box title="Featured Projects" key="community_featured_projects">
<Box
title={formatMessage({
id: 'splash.featuredProjects',
defaultMessage: 'Featured Projects'})}
key="community_featured_projects">
<Carousel items={this.state.featuredGlobal.community_featured_projects} />
</Box>,
<Box title="Featured Studios" key="community_featured_studios">
<Box
title={formatMessage({
id: 'splash.featuredStudios',
defaultMessage: 'Featured Studios'})}
key="community_featured_studios">
<Carousel items={this.state.featuredGlobal.community_featured_studios} />
</Box>
];
@ -95,7 +105,7 @@ var Splash = React.createClass({
title={
'Projects Curated by ' +
this.state.featuredGlobal.curator_top_projects[0].curator_name}
moreTitle="Learn More"
moreTitle={formatMessage({id: 'general.learnMore', defaultMessage: 'Learn More'})}
moreHref="/studios/386359/">
<Carousel items={this.state.featuredGlobal.curator_top_projects} />
</Box>
@ -109,9 +119,11 @@ var Splash = React.createClass({
<Box
key="scratch_design_studio"
title={
'Scratch Design Studio - ' +
this.state.featuredGlobal.scratch_design_studio[0].gallery_title}
moreTitle="Visit the studio"
formatMessage({
id: 'splash.scratchDesignStudioTitle',
defaultMessage: 'Scratch Design Studio' })
+ ' - ' + this.state.featuredGlobal.scratch_design_studio[0].gallery_title}
moreTitle={formatMessage({id: 'splash.visitTheStudio', defaultMessage: 'Visit the studio'})}
moreHref={'/studios/' + this.state.featuredGlobal.scratch_design_studio[0].gallery_id + '/'}>
<Carousel items={this.state.featuredGlobal.scratch_design_studio} />
</Box>
@ -120,7 +132,12 @@ var Splash = React.createClass({
if (this.state.session.user) {
rows.push(
<Box title="Recently Shared Projects" key="community_newest_projects">
<Box
title={
formatMessage({
id: 'splash.recentlySharedProjects',
defaultMessage: 'Recently Shared Projects' })}
key="community_newest_projects">
<Carousel items={this.state.featuredGlobal.community_newest_projects} />
</Box>
);
@ -128,14 +145,24 @@ var Splash = React.createClass({
if (this.state.featuredCustom.custom_projects_by_following) {
rows.push(
<Box title="Projects by Scratchers I'm Following" key="custom_projects_by_following">
<Box
title={
formatMessage({
id: 'splash.projectsByScratchersFollowing',
defaultMessage: 'Projects by Scratchers I\'m Following'})}
key="custom_projects_by_following">
<Carousel items={this.state.featuredCustom.custom_projects_by_following} />
</Box>
);
}
if (this.state.featuredCustom.custom_projects_loved_by_following) {
rows.push(
<Box title="Projects Loved by Scratchers I'm Following" key="custom_projects_loved_by_following">
<Box
title={
formatMessage({
id: 'splash.projectsLovedByScratchersFollowing',
defaultMessage: 'Projects Loved by Scratchers I\'m Following'})}
key="custom_projects_loved_by_following">
<Carousel items={this.state.featuredCustom.custom_projects_loved_by_following} />
</Box>
);
@ -143,17 +170,32 @@ var Splash = React.createClass({
if (this.state.featuredCustom.custom_projects_in_studios_following) {
rows.push(
<Box title="Projects in Studios I'm Following" key="custom_projects_in_studios_following">
<Box
title={
formatMessage({
id:'splash.projectsInStudiosFollowing',
defaultMessage: 'Projects in Studios I\'m Following'})}
key="custom_projects_in_studios_following">
<Carousel items={this.state.featuredCustom.custom_projects_in_studios_following} />
</Box>
);
}
rows.push(
<Box title="What the Community is Remixing" key="community_most_remixed_projects">
<Box
title={
formatMessage({
id: 'splash.communityRemixing',
defaultMessage: 'What the Community is Remixing' })}
key="community_most_remixed_projects">
<Carousel items={this.state.featuredGlobal.community_most_remixed_projects} showRemixes={true} />
</Box>,
<Box title="What the Community is Loving" key="community_most_loved_projects">
<Box
title={
formatMessage({
id: 'splash.communityLoving',
defaultMessage: 'What the Community is Loving' })}
key="community_most_loved_projects">
<Carousel items={this.state.featuredGlobal.community_most_loved_projects} showLoves={true} />
</Box>
);
@ -213,6 +255,6 @@ var Splash = React.createClass({
</div>
);
}
});
}));
render(<Splash />, document.getElementById('view'));