Remove dependency on scratchr2_translations

This commit is contained in:
chrisgarrity 2019-02-20 14:46:30 -05:00
parent 32484656ba
commit f3d60a1a2d
2 changed files with 16 additions and 3 deletions

View file

@ -123,6 +123,16 @@ var defaultLocales = {
var views = [];
var localizedAssetUrls = {};
// Most views will have the same name for:
// - the view folder
// - the route name
// - the transifex resource
// Add exceptions:
// - txMapping: if the name of the transifex resource is different from the route name
var txMapping = {
'projects': 'preview',
'scratch_1.4': 'scratch_14' // transifex doesn't allow dots in resource names
};
// start with english default for all views
for (var v in routes) {
if (typeof routes[v].redirect !== 'undefined') {
@ -193,11 +203,12 @@ async.forEachLimit(views, 5, function (view, cb) {
// merge view specific english strings, first then other languages
async.forEach(allLangs, function (isoCode, cb) {
var txResource = txMapping[view] || view;
var translationsFile = path.resolve(
__dirname,
'../',
localesDir,
'scratch-website.' + view + '-l10njson',
'scratch-website.' + txResource + '-l10njson',
isoCode + '.json'
);
fs.readFile(translationsFile, 'utf8', function (err, data) {

View file

@ -11,7 +11,10 @@
"smoke-sauce": "SMOKE_REMOTE=true tap ./test/integration/smoke-testing/*.js --timeout=60000",
"watch": "make watch",
"build": "make build",
"dev": "make watch && make start &"
"dev": "make watch && make start &",
"translate:urls": "node ./bin/get-localized-urls localized-urls.json",
"translate:files": "node ./bin/build-locales node_modules/scratch-l10n/www intl",
"translate": "npm run translate:urls && npm run translate:files"
},
"repository": {
"type": "git",
@ -104,7 +107,6 @@
"redux-thunk": "2.0.1",
"sass-loader": "6.0.6",
"scratch-l10n": "latest",
"scratchr2_translations": "git://github.com/LLK/scratchr2_translations.git#master",
"slick-carousel": "1.6.0",
"source-map-support": "0.3.2",
"style-loader": "0.12.3",