-
Notifications
You must be signed in to change notification settings - Fork 847
Workflow for new resources and materials
chrisgarrity edited this page Jun 21, 2017
·
1 revision
This is the process for new resources, for example a new set of Activity cards.
- Fork the https://github.com/LLK/scratch-resources repo
- Add source files that translators would need to create translated versions to the source tree. If the new resource is cards or a guide, put it in the cards or guides directories. Otherwise create new folders as needed.
- (optional) If the new resource is a folder for an inDesign project, and it is not in the cards or guides folders, the make-zips.sh script will need to be modified to generate zip files for the new location. If you skip this step translators will have to download the source files for inDesign one at a time. If the new resource is a single file (e.g. newCards.pptx), this is unnecessary.
- Add the output (PDF) file to the www tree as the 'en' version. For example, if it's a new set of cards add it to
resources/www/cards/en/
. If it's a new kind of resources add a new folder at the same level as cards and guides, and then put the file(s) in an 'en' subfolder.
Important: The filename should contain only alphanumeric characters with-
and_
. The filename (and directory names) are used in various places (json, urls, etc), and things will be much easier to manage if there are no spaces or special characters that would have to be escaped in the file names etc.
Once the file has been added to scratch-resources and deployed, it can be added to www.
- Run
./bin/get-localized-urls localized-urls.json
to get the id and default value for the resource. The data will be inbin/lib/localized-urls.json
(note: when localized-urls.json ends up packaged for npm, the file will simply be in node_modules/... and you won't need to run the script) - Add an
l10n-static.json
file in the view that is going to use the resource, and add the key:value to the file. Or modify the currentl10n-static.json
to add the key:value pair if the file already exists. This file is primarily to define which of the static URLs are needed in this view. It is used in the build process. - In your view .jsx file define formatMessage:
var formatMessage = this.props.intl.formatMessage;
, then useformatMessage({id: 'key for your resource here'})
anywhere you need the URL. Re-runnpm run build
to pick up any changes to translations.
As translations get added to scratch-resources, the localized-urls.json will automatically get updated and new translations will automatically get included next time www is built.
- Deploying scratch-resources to s3 only adds files to the bucket. If you need to remove resources from scratch-resources they will need to be manually removed from the S3 bucket as well.
- scratch-resources is cached on fastly. Published resources are rarely changed, but if they are it may also require a purge of fastly.