mirror of
https://github.com/scratchfoundation/scratch-l10n.git
synced 2024-12-22 13:42:30 -05:00
Add scratch-paint
Breaking change - bumped major version to 2. Restructured to support multiple components. Package default is just localeData for currently supported locales including the name for each language. messages for each component are exported as separate files in locales. Clients of l10n will need to import messages for each of the compents used and combine them.
This commit is contained in:
parent
5c869f6c1f
commit
0cb13cbaee
10 changed files with 362 additions and 46 deletions
|
@ -6,3 +6,8 @@ file_filter = gui/<lang>.json
|
||||||
source_file = gui/en.json
|
source_file = gui/en.json
|
||||||
source_lang = en
|
source_lang = en
|
||||||
type = CHROME
|
type = CHROME
|
||||||
|
[experimental-scratch.scratch-paint]
|
||||||
|
file_filter = paint/<lang>.json
|
||||||
|
source_file = paint/en.json
|
||||||
|
source_lang = en
|
||||||
|
type = CHROME
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "scratch-l10n",
|
"name": "scratch-l10n",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
"description": "Localization for the Scratch 3.0 components",
|
"description": "Localization for the Scratch 3.0 components",
|
||||||
"main": "./dist/l10n.js",
|
"main": "./dist/l10n.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
62
paint/ar.json
Normal file
62
paint/ar.json
Normal file
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
62
paint/de.json
Normal file
62
paint/de.json
Normal file
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
62
paint/en.json
Normal file
62
paint/en.json
Normal file
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
62
paint/es.json
Normal file
62
paint/es.json
Normal file
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
62
paint/he.json
Normal file
62
paint/he.json
Normal file
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
|
@ -45,9 +45,10 @@ import locales from '../src/supported-locales.js';
|
||||||
const MSGS_DIR = './locales/';
|
const MSGS_DIR = './locales/';
|
||||||
let missingLocales = [];
|
let missingLocales = [];
|
||||||
|
|
||||||
// GUI messages:
|
// generate messages:
|
||||||
let component = 'gui';
|
let components = ['gui', 'paint'];
|
||||||
let messages = Object.keys(locales).reduce((collection, lang) => {
|
components.forEach((component) => {
|
||||||
|
let messages = Object.keys(locales).reduce((collection, lang) => {
|
||||||
let langMessages = {};
|
let langMessages = {};
|
||||||
try {
|
try {
|
||||||
let langData = JSON.parse(
|
let langData = JSON.parse(
|
||||||
|
@ -57,24 +58,24 @@ let messages = Object.keys(locales).reduce((collection, lang) => {
|
||||||
langMessages[id] = langData[id].message;
|
langMessages[id] = langData[id].message;
|
||||||
});
|
});
|
||||||
collection[lang] = {
|
collection[lang] = {
|
||||||
name: locales[lang],
|
|
||||||
messages: langMessages
|
messages: langMessages
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
missingLocales.push(lang);
|
missingLocales.push(lang);
|
||||||
}
|
}
|
||||||
return collection;
|
return collection;
|
||||||
}, {});
|
}, {});
|
||||||
|
|
||||||
mkdirpSync(MSGS_DIR);
|
mkdirpSync(MSGS_DIR);
|
||||||
let data =
|
let data =
|
||||||
'// GENERATED FILE:\n' +
|
'// GENERATED FILE:\n' +
|
||||||
'const ' + component + 'Msgs = ' +
|
'const ' + component + 'Msgs = ' +
|
||||||
JSON.stringify(messages, null, 2) +
|
JSON.stringify(messages, null, 2) +
|
||||||
'\nexports.locales = ' + component + 'Msgs;\n';
|
'\nexports.messages = ' + component + 'Msgs;\n';
|
||||||
fs.writeFileSync(MSGS_DIR + component + '-msgs.js', data);
|
fs.writeFileSync(MSGS_DIR + component + '-msgs.js', data);
|
||||||
|
|
||||||
if (missingLocales.length > 0) {
|
if (missingLocales.length > 0) {
|
||||||
process.stdout.write('missing locales: ' + missingLocales.toString());
|
process.stdout.write('missing locales: ' + missingLocales.toString());
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
16
src/index.js
16
src/index.js
|
@ -3,15 +3,15 @@ import ar from 'react-intl/locale-data/ar';
|
||||||
import de from 'react-intl/locale-data/de';
|
import de from 'react-intl/locale-data/de';
|
||||||
import es from 'react-intl/locale-data/es';
|
import es from 'react-intl/locale-data/es';
|
||||||
import he from 'react-intl/locale-data/he';
|
import he from 'react-intl/locale-data/he';
|
||||||
|
import locales from './supported-locales.js';
|
||||||
|
|
||||||
import {locales} from '../locales/gui-msgs.js';
|
let localeData = locales;
|
||||||
|
localeData.en.localeData = en;
|
||||||
locales.en.localeData = en;
|
localeData.ar.localeData = ar;
|
||||||
locales.ar.localeData = ar;
|
localeData.de.localeData = de;
|
||||||
locales.de.localeData = de;
|
localeData.es.localeData = es;
|
||||||
locales.es.localeData = es;
|
localeData.he.localeData = he;
|
||||||
locales.he.localeData = he;
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
locales as default
|
localeData as default
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,11 +4,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const locales = {
|
const locales = {
|
||||||
en: 'English',
|
en: {name: 'English'},
|
||||||
ar: 'العربية',
|
ar: {name: 'العربية'},
|
||||||
de: 'Deutsch',
|
de: {name: 'Deutsch'},
|
||||||
es: 'Español',
|
es: {name: 'Español'},
|
||||||
he: 'עִבְרִית'
|
he: {name: 'עִבְרִית'}
|
||||||
};
|
};
|
||||||
|
|
||||||
export {locales as default};
|
export {locales as default};
|
||||||
|
|
Loading…
Reference in a new issue