Skip to content
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

Adding 'localizes' to allow some string translations for Snap5 #2341

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/byob.js
Original file line number Diff line number Diff line change
Expand Up @@ -2234,8 +2234,7 @@ BlockEditorMorph.prototype.close = function () {
block.addShadow();
new DialogBoxMorph().inform(
'Local Block(s) in Global Definition',
'This global block definition contains one or more\n'
+ 'local custom blocks which must be removed first.',
localize('This global block definition contains one or more\nlocal custom blocks which must be removed first.'),
myself.world(),
block.fullImage()
);
Expand All @@ -2251,8 +2250,8 @@ BlockEditorMorph.prototype.close = function () {
block.addShadow();
new DialogBoxMorph(this, 'consolidateDoubles', this).askYesNo(
'Same Named Blocks',
'Another custom block with this name exists.\n'
+ 'Would you like to replace it?',
localize('Another custom block with this name exists.\n')
+ localize('Would you like to replace it?'),
myself.world(),
block.fullImage()
);
Expand Down
24 changes: 10 additions & 14 deletions src/gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -5412,20 +5412,16 @@ IDE_Morph.prototype.initializeCloud = function () {
myself.source = 'cloud';
if (!isNil(response.days_left)) {
new DialogBoxMorph().inform(
'Unverified account: ' +
response.days_left +
' days left',
'You are now logged in, and your account\n' +
'is enabled for three days.\n' +
'Please use the verification link that\n' +
'was sent to your email address when you\n' +
'signed up.\n\n' +
'If you cannot find that email, please\n' +
'check your spam folder. If you still\n' +
'cannot find it, please use the "Resend\n' +
'Verification Email..." option in the cloud\n' +
'menu.\n\n' +
'You have ' + response.days_left + ' days left.',
localize('Unverified account: ')
+ response.days_left
+ localize(' days left'),
localize('You are now logged in, and your account\nis enabled for three days.\n')
+ localize('Please use the verification link that\nwas sent to your email address when you\nsigned up.\n\n')
+ localize('If you cannot find that email, please\ncheck your spam folder.\n')
+ localize('If you still cannot find it\n, please use the "Resend\nVerification Email..." option\nin the cloud menu.\n\n')
+ localize('You have ')
+ response.days_left
+ localize(' days left.'),
world,
myself.cloudIcon(null, new Color(0, 180, 0))
);
Expand Down
4 changes: 2 additions & 2 deletions src/paint.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,8 @@ PaintEditorMorph.prototype.buildEdits = function () {
function () {
if (myself.paper.undoBuffer.length > 0) {
myself.ide.confirm(
'This will erase your current drawing.\n' +
'Are you sure you want to continue?',
localize('This will erase your current drawing.\n') +
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm.... I don't think these strings need to be explicitly localized at all here. When I look at the code for the IDE_Morph >> confirm method it already has a call to localize in it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmoenig
Yes, but the issue here is the same as the previous comment. I know ide.confirm has already a call to localize, but here we have again message made up with different strings. If we want that the translation dictionary was the same that the code dictionary (the same strings), I have to call a "localize" for each shorter string.

localize('Are you sure you want to continue?'),
'Switch to vector editor?',
function () {
myself.switchToVector();
Expand Down
7 changes: 3 additions & 4 deletions src/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -977,10 +977,9 @@ VectorPaintEditorMorph.prototype.buildEdits = function () {
function () {
if (myself.shapes.length > 0) {
myself.ide.confirm(
'This will convert your vector objects into\n' +
'bitmaps, and you will not be able to convert\n' +
'them back into vector drawings.\n' +
'Are you sure you want to continue?',
localize('This will convert your vector objects into\nbitmaps,')
+ localize(' and you will not be able to convert\nthem back into vector drawings.\n')
+ localize('Are you sure you want to continue?'),
'Convert to bitmap?',
function () {
myself.convertToBitmap();
Expand Down