-
{_('Default colors')}
+
{_('Default Colors')}
diff --git a/src/components/widgets/text_editors/RichText/LinkEditor.js b/src/components/widgets/text_editors/RichText/LinkEditor.js
index 2ada97a09..213b8a5b4 100644
--- a/src/components/widgets/text_editors/RichText/LinkEditor.js
+++ b/src/components/widgets/text_editors/RichText/LinkEditor.js
@@ -89,7 +89,7 @@ class LinkEditor extends Component {
render() {
const {position} = this.state;
const {onBlur, onFocus, linkURL, localize: _} = this.props;
- const placeholderText = _('Enter link URL');
+ const placeholderText = _('Enter Link URL');
const urlText = _('URL');
return (
diff --git a/src/lib/constants.js b/src/lib/constants.js
index 6ec83f79a..3f9bf1cce 100644
--- a/src/lib/constants.js
+++ b/src/lib/constants.js
@@ -13,14 +13,19 @@ export const MULTI_VALUED = '\x1bMIXED_VALUES';
// how mixed values are represented in text inputs
export const MULTI_VALUED_PLACEHOLDER = '---';
-export const multiValueText = {
- title: 'Multiple Values',
- text:
- 'This input has multiple values associated with it. ' +
- 'Changing this setting will override these custom inputs.',
- subText:
- "Common Case: An 'All' tab might display this message " +
- 'because the X and Y tabs contain different settings.',
+export const getMultiValueText = (key, _) => {
+ const multiValueText = {
+ title: _('Multiple Values'),
+ text: _(
+ 'This input has multiple values associated with it. ' +
+ 'Changing this setting will override these custom inputs.'
+ ),
+ subText: _(
+ "Common Case: An 'All' tab might display this message " +
+ 'because the X and Y tabs contain different settings.'
+ ),
+ };
+ return multiValueText[key];
};
export const EDITOR_ACTIONS = {
diff --git a/utils/findLocaleStrings.js b/utils/findLocaleStrings.js
new file mode 100644
index 000000000..4485e9d50
--- /dev/null
+++ b/utils/findLocaleStrings.js
@@ -0,0 +1,110 @@
+import {transform} from 'babel-core';
+import traverse from 'babel-traverse';
+import fs from 'fs';
+import glob from 'glob';
+import path from 'path';
+
+const pathToSrc = path.join(__dirname, '../src');
+const srcGlob = path.join(pathToSrc, '**/*.js');
+
+const localizeRE = /(^|[\.])(_|localize)$/;
+
+findLocaleStrings();
+
+function findLocaleStrings() {
+ glob(srcGlob, (err, files) => {
+ if (err) {
+ throw new Error(err);
+ }
+
+ const dict = {};
+ let hasTranslation = false;
+ let maxLen = 0;
+
+ files.forEach(file => {
+ const code = fs.readFileSync(file, 'utf-8');
+ const filePartialPath = file.substr(pathToSrc.length);
+ const ast = transform(code, {
+ presets: ['react', 'es2015', 'stage-2'],
+ }).ast;
+
+ traverse(ast, {
+ enter(path) {
+ if (
+ path.node.type === 'CallExpression' &&
+ path.node.callee.name === '_'
+ ) {
+ const strNode = path.node.arguments[0];
+ let strNodeValue = strNode.value;
+
+ if (path.node.arguments.length !== 1) {
+ logError(file, path.node, 'Localize takes 1 args');
+ }
+
+ if (
+ ['StringLiteral', 'BinaryExpression'].indexOf(strNode.type) < 0
+ ) {
+ logError(
+ file,
+ path.node,
+ `The localization function takes a string as argument, instead it received a ${
+ strNode.type
+ }`
+ );
+ }
+
+ if (strNode.type === 'BinaryExpression') {
+ strNodeValue = path.get('arguments')[0].evaluate().value;
+ if (typeof strNodeValue !== 'string') {
+ logError(
+ file,
+ path.node,
+ `The localization function takes a string as argument, instead it received a ${typeof strNodeValue}`
+ );
+ }
+ }
+
+ if (!dict[strNodeValue]) {
+ dict[strNodeValue] =
+ filePartialPath + ':' + strNode.loc.start.line;
+ maxLen = Math.max(maxLen, strNodeValue.length);
+ hasTranslation = true;
+ }
+ }
+ },
+ });
+ });
+
+ if (!hasTranslation) {
+ throw new Error('Found no translations.');
+ }
+
+ const strings = Object.keys(dict)
+ .sort()
+ .map(k => k + spaces(maxLen - k.length) + ' // ' + dict[k])
+ .join('\n');
+ const pathToTranslationKeys = path.join(__dirname, 'translationKeys.txt');
+ fs.writeFile(pathToTranslationKeys, strings);
+ console.log(`translation keys were written to: ${pathToTranslationKeys}`);
+ });
+}
+
+function logError(file, node, msg) {
+ throw new Error(
+ file + ' [line ' + node.loc.start.line + '] ' + msg + '\n '
+ );
+}
+
+function spaces(len) {
+ let out = '';
+ for (let i = 0; i < len; i++) {
+ out += ' ';
+ }
+ return out;
+}
+
+process.on('exit', function(code) {
+ if (code === 1) {
+ throw new Error('findLocaleStrings failed.');
+ }
+});
diff --git a/utils/translationKeys.txt b/utils/translationKeys.txt
new file mode 100644
index 000000000..ef2f856b1
--- /dev/null
+++ b/utils/translationKeys.txt
@@ -0,0 +1,106 @@
+Anchor Point // /DefaultEditor.js:253
+Angle // /DefaultEditor.js:227
+Arrow // /DefaultEditor.js:229
+Arrowhead // /DefaultEditor.js:239
+Auto // /DefaultEditor.js:178
+Axes // /DefaultEditor.js:300
+Background Color // /DefaultEditor.js:380
+Bar Padding // /DefaultEditor.js:147
+Bar Width // /DefaultEditor.js:139
+Bars // /components/containers/TraceMarkerSection.js:20
+Blank // /DefaultEditor.js:166
+Border Color // /DefaultEditor.js:134
+Border Width // /DefaultEditor.js:133
+Bottom // /DefaultEditor.js:213
+Box Padding // /DefaultEditor.js:151
+Box Width // /DefaultEditor.js:143
+Canvas // /DefaultEditor.js:174
+Center // /DefaultEditor.js:265
+Color // /DefaultEditor.js:118
+Common Case: An 'All' tab might display this message because the X and Y tabs contain different settings. // /lib/constants.js:24
+Connect // /DefaultEditor.js:165
+Connect Gaps // /DefaultEditor.js:162
+Continue // /components/widgets/text_editors/MultiFormatTextEditor.js:197
+Continuing will convert your LaTeX expression into raw text. // /components/widgets/text_editors/MultiFormatTextEditor.js:121
+Continuing will convert your note to LaTeX-style text. // /components/widgets/text_editors/MultiFormatTextEditor.js:116
+Continuing will remove your expression. // /components/widgets/text_editors/MultiFormatTextEditor.js:126
+Custom // /DefaultEditor.js:179
+Custom Colors // /components/widgets/ColorPicker.js:52
+Default Colors // /components/widgets/ColorPicker.js:75
+Display // /DefaultEditor.js:94
+Edit in HTML // /components/widgets/text_editors/MultiFormatTextEditor.js:34
+Edit in Rich Text // /components/widgets/text_editors/MultiFormatTextEditor.js:241
+Enter Link URL // /components/widgets/text_editors/RichText/LinkEditor.js:92
+Filled Area // /DefaultEditor.js:104
+Fixed Height // /DefaultEditor.js:183
+Fixed Width // /DefaultEditor.js:182
+Font Color // /DefaultEditor.js:199
+Font Size // /DefaultEditor.js:195
+Global Font // /DefaultEditor.js:201
+Go back // /components/widgets/text_editors/MultiFormatTextEditor.js:191
+Heads up! // /components/widgets/text_editors/MultiFormatTextEditor.js:179
+Hide // /DefaultEditor.js:234
+Horizontal // /DefaultEditor.js:126
+Horizontal Postitioning // /DefaultEditor.js:251
+LaTeX // /components/widgets/text_editors/MultiFormatTextEditor.js:29
+LaTeX is a math typesetting language that doesn't work with rich text. // /components/widgets/text_editors/MultiFormatTextEditor.js:114
+Layout // /DefaultEditor.js:173
+Left // /DefaultEditor.js:214
+Legend // /DefaultEditor.js:353
+Legend Box // /DefaultEditor.js:369
+Line Color // /DefaultEditor.js:158
+Line Width // /DefaultEditor.js:237
+Linear // /DefaultEditor.js:324
+Lines // /DefaultEditor.js:156
+Margins and Padding // /DefaultEditor.js:211
+Max // /DefaultEditor.js:320
+Middle // /DefaultEditor.js:288
+Min // /DefaultEditor.js:319
+Multiple Values // /lib/constants.js:18
+Normal // /DefaultEditor.js:439
+Note Text // /DefaultEditor.js:222
+Notes // /DefaultEditor.js:220
+Opacity // /DefaultEditor.js:79
+Orientation // /DefaultEditor.js:426
+Padding // /DefaultEditor.js:216
+Points // /components/containers/TraceMarkerSection.js:22
+Position // /DefaultEditor.js:272
+Positioning // /DefaultEditor.js:384
+Range // /DefaultEditor.js:309
+Relative To // /DefaultEditor.js:271
+Reversed // /DefaultEditor.js:440
+Rich Text // /components/widgets/text_editors/MultiFormatTextEditor.js:24
+Rich text is incompatible with LaTeX. // /components/widgets/text_editors/MultiFormatTextEditor.js:120
+Right // /DefaultEditor.js:215
+Scale // /DefaultEditor.js:241
+Selection // /DefaultEditor.js:311
+Shape // /DefaultEditor.js:160
+Show // /DefaultEditor.js:233
+Size // /DefaultEditor.js:131
+Size and Spacing // /DefaultEditor.js:137
+Symbol // /DefaultEditor.js:132
+Text // /DefaultEditor.js:364
+Text Attributes // /DefaultEditor.js:82
+The anchor point determines which side of the annotation's positioning coordinates refer to. // /DefaultEditor.js:256
+The positioning inputs are relative to the anchor points on the text box. // /DefaultEditor.js:389
+This input has multiple values associated with it. Changing this setting will override these custom inputs. // /lib/constants.js:20
+Tick Labels // /DefaultEditor.js:334
+Tick Markers // /DefaultEditor.js:342
+Title // /DefaultEditor.js:187
+Title and Fonts // /DefaultEditor.js:186
+Titles // /DefaultEditor.js:301
+Top // /DefaultEditor.js:212
+Trace // /DefaultEditor.js:78
+Trace Order // /DefaultEditor.js:435
+Type // /DefaultEditor.js:159
+Typeface // /DefaultEditor.js:190
+URL // /components/widgets/text_editors/RichText/LinkEditor.js:93
+Vertical // /DefaultEditor.js:125
+Vertical Postitioning // /DefaultEditor.js:274
+Width // /DefaultEditor.js:157
+X Position // /DefaultEditor.js:414
+X Vector // /DefaultEditor.js:248
+Y Position // /DefaultEditor.js:420
+Y Vector // /DefaultEditor.js:249
+Zoom Interactivity // /DefaultEditor.js:345
+log // /DefaultEditor.js:325
\ No newline at end of file