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

Empty English strings localized into "<!-- -->" in French #5399

Closed
echoix opened this issue Aug 23, 2021 · 8 comments
Closed

Empty English strings localized into "<!-- -->" in French #5399

echoix opened this issue Aug 23, 2021 · 8 comments
Assignees
Labels
component: i18n issue: bug Describes why the code or behaviour is wrong

Comments

@echoix
Copy link

echoix commented Aug 23, 2021

Describe the bug

Some blocks, like the function block with or without outputs, are displayed differently in English and in French.
In French, there is an extra <!-- --> on the left of the block.

To Reproduce

Steps to reproduce the behavior:

  1. Open Blockly Code Editor demo, in English.
  2. Add a function block with an output and place it on the screen.
  3. In the top right corner, change the language to French
  4. Observe the left side of the block with an additional <!-- -->

You can also use the two following links to open the shared demo illustrating the problem:
https://blockly-demo.appspot.com/static/demos/code/index.html?lang=fr#czndiz
https://blockly-demo.appspot.com/static/demos/code/index.html?lang=en#czndiz

Expected behavior

There is no <!-- --> text displayed when not needed

Screenshots

image
image

Desktop (please complete the following information):

  • OS: Windows 10
  • Google Chrome
  • Version 92.0.4515.159 (Build officiel) (64 bits)

Stack Traces

No error in stack trace if I looked at the good place.

Additional context

I did a little bit of investigation since I observed the problem when localizing a downstream project that we are about to release our version 2, that is using Blockly version 6.20210701.0.
In French, there was an extra <!-- --> that weren't in my translated strings.
The original problematic French string was Blockly.Msg["PROCEDURES_DEFNORETURN_DO"] = "<!-- -->";
When searching in this repository's msg folder for <!-- -->, I didn't find any other language that was affected except French, where the following 7 strings have this value:

  1. Blockly.Msg["LISTS_GET_INDEX_TAIL"]
  2. Blockly.Msg["LISTS_GET_SUBLIST_TAIL"]
  3. Blockly.Msg["MATH_ONLIST_HELPURL"]
  4. Blockly.Msg["ORDINAL_NUMBER_SUFFIX"]
  5. Blockly.Msg["PROCEDURES_DEFNORETURN_DO"]
  6. Blockly.Msg["TEXT_CHARAT_TAIL"]
  7. Blockly.Msg["TEXT_GET_SUBSTRING_TAIL"]

image

Other languages have some text in some of these 7 strings, and others leave it blank and have a comment saying it's untranslated (Blockly.Msg["TEXT_GET_SUBSTRING_TAIL"] = ""; // untranslated).

Looking at the git history, the <!-- --> were introduced in commit aed9ba1 (Rebuild (#4733)) on 2021-03-25 at 12:37 for the msg/js/fr.js file. For the msg/json/fr.json file, the commit introducing the changes was 21fd86a on 2021-02-15 at 08:40 (a translatewiki update).
Before the introduction of changes, there was either nothing, an empty string with the untranslated comment, or at one point "ORDINAL_NUMBER_SUFFIX": "<!-- ---->".

In the issues I looked for, I couldn't see anything related except the discussion about the ordinal number suffix.

@echoix echoix added issue: triage Issues awaiting triage by a Blockly team member issue: bug Describes why the code or behaviour is wrong labels Aug 23, 2021
@NeilFraser NeilFraser added component: i18n and removed issue: triage Issues awaiting triage by a Blockly team member labels Aug 23, 2021
@NeilFraser NeilFraser self-assigned this Aug 23, 2021
NeilFraser added a commit that referenced this issue Aug 23, 2021
@NeilFraser
Copy link
Contributor

Excellent bug report! Looks like a one-off issue with whomever was doing French translations six months ago. I've removed those translations from the translatewiki branch, and they should disappear from Blockly in the next release.

It's possible that translatewiki's next push reverts the deletion by restoring these translations. If this happens, then we need to delete them again, and notify them to explicitly pull.

@echoix
Copy link
Author

echoix commented Aug 23, 2021

Excellent bug report!

Thanks for the compliment! I did my best, but couldn't find the strings like PROCEDURES_DEFNORETURN_DO in the translatewiki system, and I don't understand it yet, so couldn't fix it myself.

Could I be notified when the fixes are actually included in a release, so we could bump our requirements in the downstream project with that version?

@NeilFraser
Copy link
Contributor

New releases are announced here: https://groups.google.com/g/blockly-announce

Although, it looks like we forgot to announce the July 2021 release on that newsgroup. Will bring this up with the team on Monday.

In the mean time, you can hack your local copy by just editing msg/js/fr.js and setting the seven offending messages to "". You can ignore the JSON files, they are part of the upstream build process.

@echoix
Copy link
Author

echoix commented Aug 23, 2021

I don't think hacking a local copy is possible, because blocky is a dependency included in our package.json resolved by npm for the users installing our node package, so it can't work that way, unless it's possible to overwrite these strings, but I'm not sure its worth that maintenance.

@NeilFraser
Copy link
Contributor

Yup, they are globals. So you should be able to just add this to your project somewhere:

Blockly.Msg["LISTS_GET_INDEX_TAIL"] = '';
Blockly.Msg["LISTS_GET_SUBLIST_TAIL"] = '';
Blockly.Msg["MATH_ONLIST_HELPURL"] = '';
Blockly.Msg["ORDINAL_NUMBER_SUFFIX"] = '';
Blockly.Msg["PROCEDURES_DEFNORETURN_DO"] = '';
Blockly.Msg["TEXT_CHARAT_TAIL"] = '';
Blockly.Msg["TEXT_GET_SUBSTRING_TAIL"] = '';

@NeilFraser
Copy link
Contributor

But make sure that you only do the above when your application is in French!

@echoix
Copy link
Author

echoix commented Aug 23, 2021

Since the project didn't use the Blockly.Msg["XXX_YYY"] syntax in the localization files, but rather Blockly.Msg.XXX_YYY, I wasn't sure it would work. But I added this to the end of my fr.js file where we localize additional custom blocks, and it seems to work. I might temporarily patch it this way.

@BeksOmega
Copy link
Collaborator

Although, it looks like we forgot to announce the July 2021 release on that newsgroup. Will bring this up with the team on Monday.

That's my bad. I missed that the internal release docs say we're supposed to bcc the announce group :/

NeilFraser added a commit that referenced this issue Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: i18n issue: bug Describes why the code or behaviour is wrong
Projects
None yet
Development

No branches or pull requests

3 participants