diff --git a/.tx/config b/.tx/config index b3292630..b9dd2b53 100644 --- a/.tx/config +++ b/.tx/config @@ -5,4 +5,9 @@ host = https://www.transifex.com file_filter = gui/.json source_file = gui/en.json source_lang = en +type = CHROME +[experimental-scratch.scratch-paint] +file_filter = paint/.json +source_file = paint/en.json +source_lang = en type = CHROME \ No newline at end of file diff --git a/package.json b/package.json index 806014fb..7c5cdc56 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scratch-l10n", - "version": "1.0.0", + "version": "2.0.0", "description": "Localization for the Scratch 3.0 components", "main": "./dist/l10n.js", "scripts": { diff --git a/paint/ar.json b/paint/ar.json new file mode 100644 index 00000000..387e3522 --- /dev/null +++ b/paint/ar.json @@ -0,0 +1,62 @@ +{ + "paint.paintEditor.fill": { + "message": "Fill", + "description": "Label for the color picker for the fill color" + }, + "paint.eraserMode.eraser": { + "message": "Eraser", + "description": "Label for the eraser tool" + }, + "paint.penMode.pen": { + "message": "Pen", + "description": "Label for the pen tool, which draws outlines" + }, + "paint.paintEditor.saturation": { + "message": "Saturation", + "description": "Label for the saturation component in the color picker" + }, + "paint.roundedRectMode.roundedRect": { + "message": "Rounded Rectangle", + "description": "Label for the rounded rectangle tool" + }, + "paint.brushMode.brush": { + "message": "Brush", + "description": "Label for the brush tool" + }, + "paint.lineMode.line": { + "message": "Line", + "description": "Label for the line tool, which draws straight line segments" + }, + "paint.reshapeMode.reshape": { + "message": "Reshape", + "description": "Label for the reshape tool, which allows changing the points in the lines of the vectors" + }, + "paint.paintEditor.brightness": { + "message": "Brightness", + "description": "Label for the brightness component in the color picker" + }, + "paint.paintEditor.costume": { + "message": "Costume", + "description": "Label for the name of a sound" + }, + "paint.rectMode.rect": { + "message": "Rectangle", + "description": "Label for the rectangle tool" + }, + "paint.ovalMode.oval": { + "message": "Circle", + "description": "Label for the oval-drawing tool" + }, + "paint.paintEditor.hue": { + "message": "Hue", + "description": "Label for the hue component in the color picker" + }, + "paint.paintEditor.stroke": { + "message": "Outline", + "description": "Label for the color picker for the outline color" + }, + "paint.selectMode.select": { + "message": "Select", + "description": "Label for the select tool, which allows selecting, moving, and resizing shapes" + } +} \ No newline at end of file diff --git a/paint/de.json b/paint/de.json new file mode 100644 index 00000000..387e3522 --- /dev/null +++ b/paint/de.json @@ -0,0 +1,62 @@ +{ + "paint.paintEditor.fill": { + "message": "Fill", + "description": "Label for the color picker for the fill color" + }, + "paint.eraserMode.eraser": { + "message": "Eraser", + "description": "Label for the eraser tool" + }, + "paint.penMode.pen": { + "message": "Pen", + "description": "Label for the pen tool, which draws outlines" + }, + "paint.paintEditor.saturation": { + "message": "Saturation", + "description": "Label for the saturation component in the color picker" + }, + "paint.roundedRectMode.roundedRect": { + "message": "Rounded Rectangle", + "description": "Label for the rounded rectangle tool" + }, + "paint.brushMode.brush": { + "message": "Brush", + "description": "Label for the brush tool" + }, + "paint.lineMode.line": { + "message": "Line", + "description": "Label for the line tool, which draws straight line segments" + }, + "paint.reshapeMode.reshape": { + "message": "Reshape", + "description": "Label for the reshape tool, which allows changing the points in the lines of the vectors" + }, + "paint.paintEditor.brightness": { + "message": "Brightness", + "description": "Label for the brightness component in the color picker" + }, + "paint.paintEditor.costume": { + "message": "Costume", + "description": "Label for the name of a sound" + }, + "paint.rectMode.rect": { + "message": "Rectangle", + "description": "Label for the rectangle tool" + }, + "paint.ovalMode.oval": { + "message": "Circle", + "description": "Label for the oval-drawing tool" + }, + "paint.paintEditor.hue": { + "message": "Hue", + "description": "Label for the hue component in the color picker" + }, + "paint.paintEditor.stroke": { + "message": "Outline", + "description": "Label for the color picker for the outline color" + }, + "paint.selectMode.select": { + "message": "Select", + "description": "Label for the select tool, which allows selecting, moving, and resizing shapes" + } +} \ No newline at end of file diff --git a/paint/en.json b/paint/en.json new file mode 100644 index 00000000..387e3522 --- /dev/null +++ b/paint/en.json @@ -0,0 +1,62 @@ +{ + "paint.paintEditor.fill": { + "message": "Fill", + "description": "Label for the color picker for the fill color" + }, + "paint.eraserMode.eraser": { + "message": "Eraser", + "description": "Label for the eraser tool" + }, + "paint.penMode.pen": { + "message": "Pen", + "description": "Label for the pen tool, which draws outlines" + }, + "paint.paintEditor.saturation": { + "message": "Saturation", + "description": "Label for the saturation component in the color picker" + }, + "paint.roundedRectMode.roundedRect": { + "message": "Rounded Rectangle", + "description": "Label for the rounded rectangle tool" + }, + "paint.brushMode.brush": { + "message": "Brush", + "description": "Label for the brush tool" + }, + "paint.lineMode.line": { + "message": "Line", + "description": "Label for the line tool, which draws straight line segments" + }, + "paint.reshapeMode.reshape": { + "message": "Reshape", + "description": "Label for the reshape tool, which allows changing the points in the lines of the vectors" + }, + "paint.paintEditor.brightness": { + "message": "Brightness", + "description": "Label for the brightness component in the color picker" + }, + "paint.paintEditor.costume": { + "message": "Costume", + "description": "Label for the name of a sound" + }, + "paint.rectMode.rect": { + "message": "Rectangle", + "description": "Label for the rectangle tool" + }, + "paint.ovalMode.oval": { + "message": "Circle", + "description": "Label for the oval-drawing tool" + }, + "paint.paintEditor.hue": { + "message": "Hue", + "description": "Label for the hue component in the color picker" + }, + "paint.paintEditor.stroke": { + "message": "Outline", + "description": "Label for the color picker for the outline color" + }, + "paint.selectMode.select": { + "message": "Select", + "description": "Label for the select tool, which allows selecting, moving, and resizing shapes" + } +} \ No newline at end of file diff --git a/paint/es.json b/paint/es.json new file mode 100644 index 00000000..387e3522 --- /dev/null +++ b/paint/es.json @@ -0,0 +1,62 @@ +{ + "paint.paintEditor.fill": { + "message": "Fill", + "description": "Label for the color picker for the fill color" + }, + "paint.eraserMode.eraser": { + "message": "Eraser", + "description": "Label for the eraser tool" + }, + "paint.penMode.pen": { + "message": "Pen", + "description": "Label for the pen tool, which draws outlines" + }, + "paint.paintEditor.saturation": { + "message": "Saturation", + "description": "Label for the saturation component in the color picker" + }, + "paint.roundedRectMode.roundedRect": { + "message": "Rounded Rectangle", + "description": "Label for the rounded rectangle tool" + }, + "paint.brushMode.brush": { + "message": "Brush", + "description": "Label for the brush tool" + }, + "paint.lineMode.line": { + "message": "Line", + "description": "Label for the line tool, which draws straight line segments" + }, + "paint.reshapeMode.reshape": { + "message": "Reshape", + "description": "Label for the reshape tool, which allows changing the points in the lines of the vectors" + }, + "paint.paintEditor.brightness": { + "message": "Brightness", + "description": "Label for the brightness component in the color picker" + }, + "paint.paintEditor.costume": { + "message": "Costume", + "description": "Label for the name of a sound" + }, + "paint.rectMode.rect": { + "message": "Rectangle", + "description": "Label for the rectangle tool" + }, + "paint.ovalMode.oval": { + "message": "Circle", + "description": "Label for the oval-drawing tool" + }, + "paint.paintEditor.hue": { + "message": "Hue", + "description": "Label for the hue component in the color picker" + }, + "paint.paintEditor.stroke": { + "message": "Outline", + "description": "Label for the color picker for the outline color" + }, + "paint.selectMode.select": { + "message": "Select", + "description": "Label for the select tool, which allows selecting, moving, and resizing shapes" + } +} \ No newline at end of file diff --git a/paint/he.json b/paint/he.json new file mode 100644 index 00000000..387e3522 --- /dev/null +++ b/paint/he.json @@ -0,0 +1,62 @@ +{ + "paint.paintEditor.fill": { + "message": "Fill", + "description": "Label for the color picker for the fill color" + }, + "paint.eraserMode.eraser": { + "message": "Eraser", + "description": "Label for the eraser tool" + }, + "paint.penMode.pen": { + "message": "Pen", + "description": "Label for the pen tool, which draws outlines" + }, + "paint.paintEditor.saturation": { + "message": "Saturation", + "description": "Label for the saturation component in the color picker" + }, + "paint.roundedRectMode.roundedRect": { + "message": "Rounded Rectangle", + "description": "Label for the rounded rectangle tool" + }, + "paint.brushMode.brush": { + "message": "Brush", + "description": "Label for the brush tool" + }, + "paint.lineMode.line": { + "message": "Line", + "description": "Label for the line tool, which draws straight line segments" + }, + "paint.reshapeMode.reshape": { + "message": "Reshape", + "description": "Label for the reshape tool, which allows changing the points in the lines of the vectors" + }, + "paint.paintEditor.brightness": { + "message": "Brightness", + "description": "Label for the brightness component in the color picker" + }, + "paint.paintEditor.costume": { + "message": "Costume", + "description": "Label for the name of a sound" + }, + "paint.rectMode.rect": { + "message": "Rectangle", + "description": "Label for the rectangle tool" + }, + "paint.ovalMode.oval": { + "message": "Circle", + "description": "Label for the oval-drawing tool" + }, + "paint.paintEditor.hue": { + "message": "Hue", + "description": "Label for the hue component in the color picker" + }, + "paint.paintEditor.stroke": { + "message": "Outline", + "description": "Label for the color picker for the outline color" + }, + "paint.selectMode.select": { + "message": "Select", + "description": "Label for the select tool, which allows selecting, moving, and resizing shapes" + } +} \ No newline at end of file diff --git a/scripts/build-data.js b/scripts/build-data.js index b10e3b23..f9be2741 100755 --- a/scripts/build-data.js +++ b/scripts/build-data.js @@ -45,36 +45,37 @@ import locales from '../src/supported-locales.js'; const MSGS_DIR = './locales/'; let missingLocales = []; -// GUI messages: -let component = 'gui'; -let messages = Object.keys(locales).reduce((collection, lang) => { - let langMessages = {}; - try { - let langData = JSON.parse( - fs.readFileSync(path.resolve(component, lang + '.json'), 'utf8') - ); - Object.keys(langData).forEach((id) => { - langMessages[id] = langData[id].message; - }); - collection[lang] = { - name: locales[lang], - messages: langMessages - }; - } catch (e) { - missingLocales.push(lang); +// generate messages: +let components = ['gui', 'paint']; +components.forEach((component) => { + let messages = Object.keys(locales).reduce((collection, lang) => { + let langMessages = {}; + try { + let langData = JSON.parse( + fs.readFileSync(path.resolve(component, lang + '.json'), 'utf8') + ); + Object.keys(langData).forEach((id) => { + langMessages[id] = langData[id].message; + }); + collection[lang] = { + messages: langMessages + }; + } catch (e) { + missingLocales.push(lang); + } + return collection; + }, {}); + + mkdirpSync(MSGS_DIR); + let data = + '// GENERATED FILE:\n' + + 'const ' + component + 'Msgs = ' + + JSON.stringify(messages, null, 2) + + '\nexports.messages = ' + component + 'Msgs;\n'; + fs.writeFileSync(MSGS_DIR + component + '-msgs.js', data); + + if (missingLocales.length > 0) { + process.stdout.write('missing locales: ' + missingLocales.toString()); + process.exit(1); } - return collection; -}, {}); - -mkdirpSync(MSGS_DIR); -let data = - '// GENERATED FILE:\n' + - 'const ' + component + 'Msgs = ' + - JSON.stringify(messages, null, 2) + - '\nexports.locales = ' + component + 'Msgs;\n'; -fs.writeFileSync(MSGS_DIR + component + '-msgs.js', data); - -if (missingLocales.length > 0) { - process.stdout.write('missing locales: ' + missingLocales.toString()); - process.exit(1); -} +}); diff --git a/src/index.js b/src/index.js index 69f7bad5..dc2b0f96 100644 --- a/src/index.js +++ b/src/index.js @@ -3,15 +3,15 @@ import ar from 'react-intl/locale-data/ar'; import de from 'react-intl/locale-data/de'; import es from 'react-intl/locale-data/es'; import he from 'react-intl/locale-data/he'; +import locales from './supported-locales.js'; -import {locales} from '../locales/gui-msgs.js'; - -locales.en.localeData = en; -locales.ar.localeData = ar; -locales.de.localeData = de; -locales.es.localeData = es; -locales.he.localeData = he; +let localeData = locales; +localeData.en.localeData = en; +localeData.ar.localeData = ar; +localeData.de.localeData = de; +localeData.es.localeData = es; +localeData.he.localeData = he; export { - locales as default + localeData as default }; diff --git a/src/supported-locales.js b/src/supported-locales.js index f93a549b..93927e15 100644 --- a/src/supported-locales.js +++ b/src/supported-locales.js @@ -4,11 +4,11 @@ */ const locales = { - en: 'English', - ar: 'العربية', - de: 'Deutsch', - es: 'Español', - he: 'עִבְרִית' + en: {name: 'English'}, + ar: {name: 'العربية'}, + de: {name: 'Deutsch'}, + es: {name: 'Español'}, + he: {name: 'עִבְרִית'} }; export {locales as default};