Skip to content

Commit ced3563

Browse files
committedOct 19, 2017
Adding scratch-l10n dependency
* Added .tx configuation to be able to send source strings to transifex * added dependency on scratch-l10n 2.x, and removed everything related to generating the l10n messages locally * updated playground intl reducer to use paint messages from l10n package
1 parent 09ef88c commit ced3563

File tree

5 files changed

+17
-86
lines changed

5 files changed

+17
-86
lines changed
 

‎.tx/config

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[main]
2+
host = https://www.transifex.com
3+
4+
[experimental-scratch.scratch-paint]
5+
file_filter = translations/<lang>.json
6+
source_file = translations/en.json
7+
source_lang = en
8+
type = CHROME

‎package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
"description": "Graphical User Interface for the Scratch 3.0 paint editor, which is used to make and edit sprites for use in projects.",
55
"main": "./dist/scratch-paint.js",
66
"scripts": {
7-
"build": "npm run clean && npm run i18n:msgs && webpack --progress --colors --bail",
7+
"build": "npm run clean && webpack --progress --colors --bail",
88
"clean": "rimraf ./dist && mkdirp dist && rimraf ./playground && mkdirp playground",
99
"deploy": "touch playground/.nojekyll && gh-pages -t -d playground -m \"Build for $(git log --pretty=format:%H -n1)\"",
10-
"i18n:msgs": "node ./scripts/generate-locale-messages.js",
1110
"i18n:src": "babel src > tmp.js && rimraf tmp.js && ./scripts/build-i18n-source.js ./translations/messages/ ./translations/",
1211
"lint": "eslint . --ext .js,.jsx",
13-
"start": "npm run i18n:msgs && webpack-dev-server",
12+
"start": "webpack-dev-server",
1413
"test": "npm run lint && npm run unit && NODE_ENV=production npm run build",
1514
"unit": "jest",
1615
"watch": "webpack --progress --colors --watch"
@@ -74,6 +73,7 @@
7473
"redux-throttle": "0.1.1",
7574
"regenerator-runtime": "^0.10.5",
7675
"rimraf": "^2.6.1",
76+
"scratch-l10n": "^2.0.0",
7777
"style-loader": "^0.18.0",
7878
"tap": "^10.2.0",
7979
"webpack": "^3.5.4",

‎scripts/generate-locale-messages.js

-67
This file was deleted.

‎src/locale.js

-11
This file was deleted.

‎src/playground/reducers/intl.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,25 @@ import {addLocaleData} from 'react-intl';
22
import {updateIntl as superUpdateIntl} from 'react-intl-redux';
33
import {IntlProvider, intlReducer} from 'react-intl-redux';
44

5-
import locales from '../../locale.js';
5+
import localeData from 'scratch-l10n';
6+
import paintMessages from 'scratch-l10n/locales/paint-msgs';
67

7-
Object.keys(locales).forEach(locale => {
8+
Object.keys(localeData).forEach(locale => {
89
// TODO: will need to handle locales not in the default intl - see www/custom-locales
9-
addLocaleData(locales[locale].localeData);
10+
addLocaleData(localeData[locale].localeData);
1011
});
1112

1213
const intlInitialState = {
1314
intl: {
1415
defaultLocale: 'en',
1516
locale: 'en',
16-
messages: locales.en.messages
17+
messages: paintMessages.messages.en.messages
1718
}
1819
};
1920

2021
const updateIntl = locale => superUpdateIntl({
2122
locale: locale,
22-
messages: locales[locale].messages || locales.en.messages
23+
messages: paintMessages.messages[locale].messages || paintMessages.messages.en.messages
2324
});
2425

2526
export {

0 commit comments

Comments
 (0)
Please sign in to comment.