From 667ff08a366e8049c603466da35f6fa574fef541 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Tue, 7 Jun 2016 18:04:18 -0400 Subject: [PATCH] L10n WIP --- src/l10n.json | 17 +++ src/views/teacherregistration/l10n.json | 31 ++++ src/views/teacherregistration/steps.jsx | 181 ++++++++++++++---------- 3 files changed, 156 insertions(+), 73 deletions(-) create mode 100644 src/views/teacherregistration/l10n.json diff --git a/src/l10n.json b/src/l10n.json index 018ebafad..df379b364 100644 --- a/src/l10n.json +++ b/src/l10n.json @@ -7,12 +7,14 @@ "general.community": "Community", "general.contactUs": "Contact Us", "general.copyright": "Scratch is a project of the Lifelong Kindergarten Group at the MIT Media Lab", + "general.country": "Country", "general.create": "Create", "general.credits": "Credits", "general.discuss": "Discuss", "general.dmca": "DMCA", "general.explore": "Explore", "general.faq": "FAQ", + "general.female": "Female", "general.forParents": "For Parents", "general.forEducators": "For Educators", "general.guidelines": "Community Guidelines", @@ -22,11 +24,26 @@ "general.legal": "Legal", "general.loadMore": "Load More", "general.learnMore": "Learn More", + "general.male": "Male", "general.messages": "Messages", + "general.monthJanuary": "January", + "general.monthFebruary": "February", + "general.monthMarch": "March", + "general.monthApril": "April", + "general.monthMay": "May", + "general.monthJune": "June", + "general.monthJuly": "July", + "general.monthAugust": "August", + "general.monthSeptember": "September", + "general.monthOctober": "October", + "general.monthNovember": "November", + "general.monthDecember": "December", "general.myClass": "My Class", "general.myClasses": "My Classes", "general.myStuff": "My Stuff", + "general.other": "Other", "general.offlineEditor": "Offline Editor", + "general.password": "Password", "general.press": "Press", "general.privacyPolicy": "Privacy Policy", "general.projects": "Projects", diff --git a/src/views/teacherregistration/l10n.json b/src/views/teacherregistration/l10n.json new file mode 100644 index 000000000..1d12cfcc9 --- /dev/null +++ b/src/views/teacherregistration/l10n.json @@ -0,0 +1,31 @@ +{ + "teacherRegistration.usernameStepDescription": "Fill in the following forms to request an account. The approval process may take up to 24 hours.", + "teacherRegistration.usernameStepTitle": "Request a Teacher Account", + "teacherRegistration.validationUsernameRegexp": "Your username may only contain characters and -", + "teacherRegistration.validationUsernameMinLength": "Usernames must be at least 3 characters", + "teacherRegistration.validationUsernameMaxLength": "Usernames must be at most 20 characters", + "teacherRegistration.validationPasswordLength": "Passwords must be at least six characters", + "teacherRegistration.validationPasswordNotEquals": "Your password may not be \"password\"", + "teacherRegistration.validationPasswordNotUsername": "Your password may not be your username", + "teacherRegistration.showPassword": "Show password", + "teacherRegistration.nextStep": "Next Step", + "teacherRegistration.personalStepTitle": "Personal Information", + "teacherRegistration.personalStepDescription": "Your individual responses will not be displayed publicly, and will be kept confidential and secure", + "teacherRegistration.nameStepTitle": "First & Last Name", + "teacherRegistration.nameStepDescription": "Your name will not be displayed publicly, and will be kept confidential and secure", + "teacherRegistration.firstName": "First Name", + "teacherRegistration.lastName": "Last Name", + "teacherRegistration.phoneStepTitle": "Phone Number", + "teacherRegistration.phoneNumber": "Phone Number", + "teacherRegistration.phoneStepDescription": "Your phone number will not be displayed publicly, and will be kept confidential and secure", + "teacherRegistration.phoneConsent": "Yes, the Scratch Team may call me to verify my Teacher Account if needed", + "teacherRegistration.validationPhoneConsent": "You must consent to verification of your Teacher Account", + "teacherRegistration.organizationChoiceElementarySchool": "Elementary School", + "teacherRegistration.organizationChoiceMiddleSchool": "Middle School", + "teacherRegistration.organizationChoiceHighSchool": "High School", + "teacherRegistration.organizationChoiceUniversity": "University / College", + "teacherRegistration.organizationChoiceMuseum": "Museum", + "teacherRegistration.organizationChoiceLibrary": "Library", + "teacherRegistration.organizationChoiceCamp": "Camp", + "teacherRegistration.organizationChoiceOther": "Other" +} diff --git a/src/views/teacherregistration/steps.jsx b/src/views/teacherregistration/steps.jsx index d15a5c026..9e6a1f468 100644 --- a/src/views/teacherregistration/steps.jsx +++ b/src/views/teacherregistration/steps.jsx @@ -1,6 +1,7 @@ var React = require('react'); var countryData = require('../../lib/country-data'); +var intl = require('../../lib/intl.jsx'); var log = require('../../lib/log'); var smartyStreets = require('../../lib/smarty-streets'); @@ -19,7 +20,7 @@ var TextArea = require('../../components/forms/textarea.jsx'); var DEFAULT_COUNTRY = 'us'; module.exports = { - UsernameStep: React.createClass({ + UsernameStep: intl.injectIntl(React.createClass({ getInitialState: function () { return {showPassword: false}; }, @@ -27,16 +28,15 @@ module.exports = { this.setState({showPassword: value}); }, render: function () { + var formatMessage = this.props.intl.formatMessage; return ( - - Creating a Teacher Account requires additional information - for review. - The approval process can take up to 24 hours -

}> + } + description={ +

+ } + >
- - - @@ -73,49 +79,55 @@ module.exports = { ); } - }), - DemographicsStep: React.createClass({ + })), + DemographicsStep: intl.injectIntl(React.createClass({ getDefaultProps: function () { return {defaultCountry: DEFAULT_COUNTRY}; }, getInitialState: function () { return {otherDisabled: true}; }, + getMonthOptions: function () { + return [ + 'January', 'February', 'March', 'April', 'May', 'June', 'July', + 'August', 'September', 'October', 'November', 'December' + ].map(function (label, id) { + return { + value: id+1, + label: this.props.intl.formatMessage({id: 'general.month' + label})}; + }.bind(this)); + }, + getYearOptions: function () { + return Array.apply(null, Array(100)).map(function (v, id) { + var year = 2016 - id; + return {value: year, label: year}; + }); + }, onChooseGender: function (name, gender) { this.setState({otherDisabled: gender !== 'other'}); }, render: function () { - var monthOptions = [ - 'January', 'February', 'March', 'April', 'May', 'June', 'July', - 'August', 'September', 'October', 'November', 'December' - ].map(function (label, id) { - return {value: id+1, label: label}; - }); - var yearOptions = Array.apply(null, Array(100)).map(function (v, id) { - var year = 2016 - id; - return {value: year, label: year}; - }); + var formatMessage = this.props.intl.formatMessage; return ( - } description={

- Your responses to these questions will be kept private. - Why do we ask for this information ? +

}> - + - - - + + +
); } - }), - PhoneNumberStep: React.createClass({ + })), + PhoneNumberStep: intl.injectIntl(React.createClass({ getDefaultProps: function () { return {defaultCountry: DEFAULT_COUNTRY}; }, render: function () { + var formatMessage = this.props.intl.formatMessage; return ( - - Your responses to these questions will be kept private. - Why do we ask for this information ? -

}> + + +

+ } + >
- - - +
); } - }), - OrganizationStep: React.createClass({ + })), + OrganizationStep: intl.injectIntl(React.createClass({ getInitialState: function () { return { otherDisabled: true }; }, + getOrganizationOptions: function () { + var choices = { + ElementarySchool: 'Elementary School', + MiddleSchool: 'Middle School', + HighSchool: 'High School', + University: 'University / College', + Museum: 'Museum', + Library: 'Library', + Camp: 'Camp', + Other: 'Other' + }; + return Object.keys(choices).map(function (key) { + return { + value: choices[key], + label: this.props.intl.formatMessage({ + id: 'teacherRegistration.organizationChoice' + key + }) + }; + }.bind(this)); + }, onChooseOrganization: function (name, values) { this.setState({otherDisabled: values.indexOf('Other') === -1}); }, render: function () { - var organizationOptions = [ - 'Elementary School', 'Middle School', 'High School', 'University / College', - 'Museum', 'Library', 'Camp', 'Other' - ].map(function (type) { return {value: type, label: type}; }); return ( ); } - }), + })), AddressStep: React.createClass({ getDefaultProps: function () { return {defaultCountry: DEFAULT_COUNTRY};