Localize tool tooltips (#573)

* Create messages.js for all tooltips as many are shared between the bitmap and vector editors:
  * Brush Translation
  * Eraser Translation
  * Fill Translation
  * Line Translation
  * Oval Translation
  * Rect Translation
  * Reshape Translation
  * RoundedRect Translation
  * Select Translation
  * Text Translation
This commit is contained in:
apple502j 2018-08-06 22:16:35 +09:00 committed by chrisgarrity
parent 6c84cbf76d
commit 5c723e5f92
19 changed files with 92 additions and 103 deletions

View file

@ -1,16 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import brushIcon from './brush.svg';
const BitBrushModeComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Brush',
description: 'Label for the brush tool',
id: 'paint.brushMode.brush'
}}
imgDescriptor={messages.brush}
imgSrc={brushIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,17 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
import messages from '../../lib/messages.js';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import eraserIcon from './eraser.svg';
const BitEraserComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Eraser',
description: 'Label for the eraser tool',
id: 'paint.eraserMode.eraser'
}}
imgDescriptor={messages.eraser}
imgSrc={eraserIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -2,16 +2,12 @@ import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import fillIcon from './fill.svg';
const BitFillComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Fill',
description: 'Label for the fill tool',
id: 'paint.fillMode.fill'
}}
imgDescriptor={messages.fill}
imgSrc={fillIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import lineIcon from './line.svg';
const BitLineComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Line',
description: 'Label for the line tool, which draws straight line segments',
id: 'paint.lineMode.line'
}}
imgDescriptor={messages.line}
imgSrc={lineIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import ovalIcon from './oval.svg';
const BitOvalComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Circle',
description: 'Label for the oval-drawing tool',
id: 'paint.ovalMode.oval'
}}
imgDescriptor={messages.oval}
imgSrc={ovalIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -2,16 +2,12 @@ import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import rectIcon from './rectangle.svg';
const BitRectComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Rectangle',
description: 'Label for the rectangle tool',
id: 'paint.rectMode.rect'
}}
imgDescriptor={messages.rect}
imgSrc={rectIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import selectIcon from './marquee.svg';
const BitSelectComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Select',
description: 'Label for the select tool, which allows selecting, moving, and resizing shapes',
id: 'paint.selectMode.select'
}}
imgDescriptor={messages.select}
imgSrc={selectIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -2,16 +2,12 @@ import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import textIcon from './text.svg';
const BitTextComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Text',
description: 'Label for the text tool',
id: 'paint.textMode.text'
}}
imgDescriptor={messages.text}
imgSrc={textIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import brushIcon from './brush.svg';
const BrushModeComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Brush',
description: 'Label for the brush tool',
id: 'paint.brushMode.brush'
}}
imgDescriptor={messages.brush}
imgSrc={brushIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import eraserIcon from './eraser.svg';
const EraserModeComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Eraser',
description: 'Label for the eraser tool',
id: 'paint.eraserMode.eraser'
}}
imgDescriptor={messages.eraser}
imgSrc={eraserIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import fillIcon from './fill.svg';
const FillModeComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Fill',
description: 'Label for the fill tool',
id: 'paint.fillMode.fill'
}}
imgDescriptor={messages.fill}
imgSrc={fillIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import lineIcon from './line.svg';
const LineModeComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Line',
description: 'Label for the line tool, which draws straight line segments',
id: 'paint.lineMode.line'
}}
imgDescriptor={messages.line}
imgSrc={lineIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import ovalIcon from './oval.svg';
const OvalModeComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Circle',
description: 'Label for the oval-drawing tool',
id: 'paint.ovalMode.oval'
}}
imgDescriptor={messages.oval}
imgSrc={ovalIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,12 @@
import React from 'react';
import PropTypes from 'prop-types';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import messages from '../../lib/messages.js';
import rectIcon from './rectangle.svg';
const RectModeComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Rectangle',
description: 'Label for the rectangle tool',
id: 'paint.rectMode.rect'
}}
imgDescriptor={messages.rect}
imgSrc={rectIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
import messages from '../../lib/messages.js';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import reshapeIcon from './reshape.svg';
const ReshapeModeComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Reshape',
description: 'Label for the reshape tool, which allows changing the points in the lines of the vectors',
id: 'paint.reshapeMode.reshape'
}}
imgDescriptor={messages.reshape}
imgSrc={reshapeIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
import messages from '../../lib/messages.js';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import roundedRectIcon from './rounded-rectangle.svg';
const RoundedRectModeComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Rounded Rectangle',
description: 'Label for the rounded rectangle tool',
id: 'paint.roundedRectMode.roundedRect'
}}
imgDescriptor={messages.roundedRect}
imgSrc={roundedRectIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
import messages from '../../lib/messages.js';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import selectIcon from './select.svg';
const SelectModeComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Select',
description: 'Label for the select tool, which allows selecting, moving, and resizing shapes',
id: 'paint.selectMode.select'
}}
imgDescriptor={messages.select}
imgSrc={selectIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

View file

@ -1,16 +1,13 @@
import React from 'react';
import PropTypes from 'prop-types';
import messages from '../../lib/messages.js';
import ToolSelectComponent from '../tool-select-base/tool-select-base.jsx';
import textIcon from './text.svg';
const TextModeComponent = props => (
<ToolSelectComponent
imgDescriptor={{
defaultMessage: 'Text',
description: 'Label for the text tool',
id: 'paint.textMode.text'
}}
imgDescriptor={messages.text}
imgSrc={textIcon}
isSelected={props.isSelected}
onMouseDown={props.onMouseDown}

56
src/lib/messages.js Normal file
View file

@ -0,0 +1,56 @@
import {defineMessages} from 'react-intl';
const messages = defineMessages({
brush: {
defaultMessage: 'Brush',
description: 'Label for the brush tool',
id: 'paint.brushMode.brush'
},
eraser: {
defaultMessage: 'Eraser',
description: 'Label for the eraser tool',
id: 'paint.eraserMode.eraser'
},
fill: {
defaultMessage: 'Fill',
description: 'Label for the fill tool',
id: 'paint.fillMode.fill'
},
line: {
defaultMessage: 'Line',
description: 'Label for the line tool',
id: 'paint.lineMode.line'
},
oval: {
defaultMessage: 'Circle',
description: 'Label for the oval-drawing tool',
id: 'paint.ovalMode.oval'
},
rect: {
defaultMessage: 'Rectangle',
description: 'Label for the rectangle tool',
id: 'paint.rectMode.rect'
},
reshape: {
defaultMessage: 'Reshape',
description: 'Label for the reshape tool, which allows changing the points in the lines of the vectors',
id: 'paint.reshapeMode.reshape'
},
roundedRect: {
defaultMessage: 'Rounded Rectangle',
description: 'Label for the rounded rectangle tool',
id: 'paint.roundedRectMode.roundedRect'
},
select: {
defaultMessage: 'Select',
description: 'Label for the select tool, which allows selecting, moving, and resizing shapes',
id: 'paint.selectMode.select'
},
text: {
defaultMessage: 'Text',
description: 'Label for the text tool',
id: 'paint.textMode.text'
}
});
export default messages;