Fixes#1199 by continuing the iteration over languages even if a view doesn’t have an l10n file. The issue was that only the `en` language object was getting added when the view didn’t have an l10n file, because of the `hasOwnProperty` check. This adjusts it to iterate over languages anyways, and only ouput the `No translations for…` message if it’s for a language of a view that does have an l10n file.
Added tx-import, expects TX_TOKEN environment variable to be set to an API token for Transifex. If no API token exists it’ll just use the default English strings for everything.
Removed the localization spot checks because they were checking tha json got built from po files. With Tx-import the files are already json, and may possibly be missing.
* Transifex transition
Scripts and configuration for transition to Transifex for translation.
* Transifex transition update
changed the name of the place where translations are saved from ‘translations’ to localizations so that we can have a consistent name in both scratchr2, and scratch-www.
A couple of other little clean-ups to make sure that it’s ES5 compliant.
- don’t use const
- don’t use template strings (backticks)
Most problems were due to strings being duplicated and overwriting each other. Updated the build-locales script to keep track of duplicates.
Project Curated by on the splash page was just missing the formatMessage call.
There is some stacking that happens in object keys that had been using the `-` to track language/view hierarchies, which was thrown off by view names that used a `-` in them. Switch to using `:`, and also make it customizable. Fixes#655
* 'develop' of https://github.com/LLK/scratch-www: (32 commits)
Lint
Bundle all locale data
Don't bundle polyfills
Set up Raven within init.js
Prefix privacyPolicy message string
Exclude minified javascript from linting
One space more
Changes "interfacesto" to "interfaces to"
Remove tag target
Filter before mapping to avoid returning undefined
Fix Pass condition for "static" routes
Spacing2
Mangling is the default
Spacing
Update for typography fixes
Cherry pick PR #476 into master
Add invisible spacer to anchored sections
For Developers
Lint JSON, expand and simplify lint step
Fix banned user redirect
...
# Conflicts:
# src/redux/actions.js
# src/redux/reducer.js
convert path variables in express (i.e. dev-server) into rules that work for fastly (i.e. `.+?`). I tried to make it `\w+?`, but javascript seemed to either want no `\`'s or two `\`'s
Since it's using `require` to get the localisation strings, check if the error is `MODULE_NOT_FOUND` before moving on – because if it isn't, then there is an unknown error that should be thrown. Thanks @rschamp for the suggestion!
Before we were using glob, which was about to start failing on subdirectories in views (which we started using in `conference`). Instead of searching for `l10n.json`, it seemed more appropriate to instead look for localization by using the configured pages that need to be localized.
Previously we relied on the static directory to construct the pass condition, but this doesn't include many things added to the build other than static files. So instead of adding these explicitly through `extraAppRoutes`, base the Pass condition on the final build, but exclude the view .html files. This way the version.txt, routes.json, and all directories added by webpack will be resolved to S3 rather than scratchr2.
Thanks @thisandagain — now I know why you said async.auto is so awesome.
Also throw the error so we get a stacktrace, and make the bucket name and service ID into constants.
* Builds the Pass condition based on the static directory and view routes.
* Updates Fastly with new header and conditions based on the view routes.
* Uses a nice module for interacting with fastly :)
Needs some major cleanup but it works. Hopefully Travis will work too.
The catch there before is meant to just continue if it comes across a file that doesn't exist (in which case the language will default to english). However, it was not specific enough – now, it only catches the error if the file doesn't exist, and throws anything else, preveting a build.
This moves all locale/translation building to a dependency, `scratch-www-intl-loader`, as well as tests associated with it. Also gets rid of the `make translations` step.
1. Load locale strings into `window._messages` in a separate file added to `template.html`, which contains view-specific and general strings
2. Update build-locales to compile separate files