Commit graph

25 commits

Author SHA1 Message Date
Ben Wheeler
033a0f5dcd don't overwrite english defaults from local l10n.json source files with transifex download 2019-05-13 11:24:38 -04:00
chrisgarrity
f3d60a1a2d Remove dependency on scratchr2_translations 2019-03-27 11:08:09 +01:00
chrisgarrity
94a8396713 Make list of languages on www consistent with gui
start to depend on `scratch-l10n`

So far only the supported locales is used.

There is one small difference between scratch-l10n and the `languages.json` that was removed.
languages was:
`{locale: ‘languagename’, …}` key value pairs.

l10n exports:
`{locale: {name: ‘languagename’},…}

That required an additional change to the language chooser.
2018-12-13 16:00:41 -05:00
chrisgarrity
376aee0eb3 Add error checking and testing for translations (#1401)
* Add error checking and testing for translations. Also make build-locales quieter if there are no problems.

* Allow build with broken translations (to allow development), but fail test so that broken translations don't get merged or deployed
2017-08-15 09:32:18 -04:00
chrisgarrity
74e315dc71 Add new Tips page (#1357)
New of tips page, uses cards from new resources server (s3)

* added get-localized-urls script to get the generated json from the s3 bucket
* added /tips route
* correct localized-urls for other pages
* remove thingstotry
* redirect /go
* fix up /info/cards view to use resources (s3).
* redirect /go to /tips
* change /hoc redirect from /go to /tips
* Add full set of cards pdf download to tips localization
* removed cards and guides from static PDFs, they are all coming from resources.scratch.mit.edu now.
* removed things to try view

Corrections for reviews:
* decided to pretty print the localized URLs
* replaced console.errors with process.stdout and fail with exit(1)
* formatted localized-urls to make it easier to read
* moved link outside  `<Button…` makes whole button clickable instead of just text
* fixed up css styles, removed unnecessary classes
* corrected “unused” resource links
2017-06-21 16:20:18 -04:00
Matthew Taylor
bab863cd14 Apply defaults for untranslated pages too
since we’ll need them for nav/footer strings
2017-05-23 13:16:46 -04:00
Matthew Taylor
3a27b1d2e2 Apply english strings as default translations
This fixes #1303 by ensuring that, if a language does not have a string, the default will be applied.
2017-05-03 14:21:27 -04:00
Matthew Taylor
1b4c14b333 Exit on error in translation building
thanks @chrisgarrity !
2017-03-13 11:51:31 -04:00
Matthew Taylor
5ca880d16a still iterate over languages for views without l10n
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.
2017-03-13 10:00:30 -04:00
Matthew Taylor
0912fca5f2 Use scratchr2_translations for language files
Adjusts the translation system to go back to using a github repo to store snapshots of transltions, but continues to use new `.json` formatted files
2017-02-24 07:58:50 -05:00
chrisgarrity
82785435bf New scripts to generate translations from Transifex
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.
2017-02-15 22:51:15 -05:00
Matthew Taylor
8e964cdfdd Still build url localization for languages with none
otherwise, they will get the id for the url, rather than the english version. Fixes #1059
2016-11-21 15:36:50 -05:00
chrisgarrity
1339683a73 Fix #940
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.
2016-10-11 12:33:31 -04:00
Matthew Taylor
4165132a3e use more descriptive variable names in loops
thanks @rschamp!
2016-05-19 10:43:25 -04:00
Matthew Taylor
fa566ac140 Fix tests, and make error check specific
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!
2016-05-19 06:56:45 -04:00
Matthew Taylor
1f871e7cf1 Use routes.json to get localization paths
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.
2016-05-18 09:49:49 -04:00
Matthew Taylor
5d693ed53d 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
2016-03-23 16:37:15 -04:00
Matthew Taylor
c448b15dd4 Refactor build-locales a bit
This makes a couple of procedure-specific parts into methods in `locale-compare`, so that they can be tested more readily.
2016-03-23 08:22:09 -04:00
Matthew Taylor
3c2fec42f2 Only catch the ENOENT error
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.
2016-03-22 16:25:05 -04:00
Matthew Taylor
1ad1380eff simplify to one loop
thanks @rschamp!
2016-01-22 10:16:18 -05:00
Matthew Taylor
a0d92dacfc Add general localizations to nonlocalized pages
For nav/footer purposes.
2016-01-19 15:52:42 -05:00
Matthew Taylor
4f704a3a4b Make error output optional for filestream 2016-01-14 08:14:38 -05:00
Matthew Taylor
ceec694b2a Revert "Migrate to using a loader method"
This reverts commit 214430b0c4.
2016-01-08 13:50:58 -05:00
Matthew Taylor
214430b0c4 Migrate to using a loader method
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.
2016-01-07 17:01:57 -05:00
Matthew Taylor
8ae98d703f Make localizations view-based
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
2016-01-06 14:09:32 -05:00