-
-
Notifications
You must be signed in to change notification settings - Fork 114
Add script to extract locale strings #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2042850 to
915fb1b
Compare
915fb1b to
9038707
Compare
|
@bpostlethwaite ready for a look |
utils/findLocaleStrings.js
Outdated
| .join('\n'); | ||
| const pathToTranslationKeys = path.join(__dirname, 'translationKeys.txt'); | ||
| fs.writeFile(pathToTranslationKeys, strings); | ||
| console.log('ok find_locale_strings'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚡
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or maybe not? Dunno
utils/findLocaleStrings.js
Outdated
| }); | ||
|
|
||
| if (!hasTranslation) { | ||
| console.error('Found no translations.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logError?
utils/findLocaleStrings.js
Outdated
| glob(srcGlob, (err, files) => { | ||
| if (err) { | ||
| EXIT_CODE = 1; | ||
| console.log(err); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.error ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or this can simply be if (err) throw(err)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that will automatically use exitcode 1 and console.error anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see there is an error handler below that catches these things.
bpostlethwaite
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to commit the translations? They are not set in stone yet and can be produced from the script so are more of a build artifact than an asset. Not sure though.
|
yeah, I can remove the translations, I believe @alexcjohnson committed them in the plotly.js repo, but it's true, it's not really necessary |
| if (!dict[strNodeValue]) { | ||
| dict[strNodeValue] = | ||
| filePartialPath + ':' + strNode.loc.start.line; | ||
| maxLen = Math.max(maxLen, strNodeValue.length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might want to put a limit on this... 80? so a few of the longest strings would not have the line-number comment lined up with the rest (just give them at least 2 spaces), but the majority of them would and it'd be closer and easier to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kind of like that they're all aligned, even if there are some long stings, I find it's more consistent for my eyes :) and makes me notice the super long strings, i.e. may be a sign that they'd need to be shortened...
I did for plotly.js, the rationale being that
|
utils/translationKeys.txt
Outdated
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like we've generally capitalized all words of titles, so Custom Colors? Default Colors? Less sure about Enter Link URL...
utils/translationKeys.txt
Outdated
| 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a nice way to correct all the text in a program.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, agreed, making corrections now :)
|
ok, made the changes @bpostlethwaite @alexcjohnson mergeable? |
|
💃 |
|
nice work! 💃 |
No description provided.