question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

code-blocks containg punctuation are broken in multiple translation strings in Crowdin

See original GitHub issue

Describe the Issue

Code blocks containing punctuation (e.g. dot and question mark) get broken in Crowdin into more than one translation string, when should be contained in a single translation string.

This is same issue as #47775 but for other strings and files, and it was solved (without editing the source code) by applying the proper setting in Crowdin as can read in that issue’s comments.

Also please notice that all the problematic strings reported below are from Learn Basic JavaScript by Building a Role Playing Game challenge. (source directory)

I divided this report per source file. Each source file have one or more problematic string referenced in “Source sentence” (I didn’t always referenced the whole paragraph!) with the respective current URL to source string in Crowdin.

Source file: 62ba17beef16c563069a65d8.md

Source sentence:
String in source file: Set the `name` property to `lose`, set `button text` to an array with three `REPLAY?` strings, set `button functions` to an array with three `restart` variables, and set `text` to `You die. ☠️`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34521/en-ptbr/132#1214165

Source sentence:
Your sixth `locations` value should have a `text` property with the value `You die. ☠️`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34521/en-ptbr/132#1214193

Source file: 62aa25fcb5837d43b4d9873d.md

Source sentence:
Set `name` to `easter egg`, set `button text` to an array with the strings `2`, `8`, and `Go to town square?`, set `button functions` to an array with the variables `pickTwo`, `pickEight`, and `goTown`, and `text` to `You find a secret game. Pick a number above. Ten numbers will be randomly chosen between 0 and 10. If the number you choose matches one of the random numbers, you win!`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34529/en-ptbr/132#1214489

Source sentence:
Your eighth `locations` value should have a `text` property with the value `You find a secret game. Pick a number above. Ten numbers will be randomly chosen between 0 and 10. If the number you choose matches one of the random numbers, you win!`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34529/en-ptbr/132#1214519

Source file: 62a94114ce0b8918b487390f.md

Source sentence:
Everything should be the same as the `lose` object, except the `name` should be `win` and the `text` should be `You defeat the dragon! YOU WIN THE GAME! 🎉`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34577/en-ptbr/132#1215973

Source sentence:
Your seventh `locations` value should have a `text` property with the value `You defeat the dragon! YOU WIN THE GAME! 🎉`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34577/en-ptbr/132#1216001

Source file: 62aa2999ec27ec516655eba6.md

Source sentence:
Inside the `if` expression, add the string `Right! You win 20 gold!` to the end of `text.innerText`. Also, add `20` to the value of `gold` and update the `goldText.innerText`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34655/en-ptbr/132#1218421

Source sentence:
You should use compound assignment to add the string `Right! You win 20 gold!` to the end of `text.innerText`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34655/en-ptbr/132#1218429

Source file: 62aa29d8f8f88152c91350ca.md

Source sentence:
Inside, add `Wrong! You lose 10 health!` to the end of `text.innerText`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34669/en-ptbr/132#1218859

Source sentence:
Your `else` block should use compound assignment to add `Wrong! You lose 10 health!` to the end of `text.innerText`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34669/en-ptbr/132#1218871

Source file: 62aa27227399d647e1c37a3c.md

Source sentence:
After the `while` loop, set `text.innerText` to equal `You picked [guess]. Here are the random numbers:`. Replace `guess` with the player's guess.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34673/en-ptbr/132#1218997

Source sentence:
You should use the concatenation operator to add the string `. Here are the random numbers:` to your `"You picked " + guess` string.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34673/en-ptbr/132#1219015

Source file: 62aa27560def7048d7b4a095.md

Source sentence:
You should add the new line escape character `\n` to your `. Here are the random numbers: ` string.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34677/en-ptbr/132#1219175

Source file: 62a8f2bc37675e77d5835235.md

Source sentence:
The syntax is: `condition ? true : false`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34687/en-ptbr/132#1219469

Source file: 62a8eff21c0b0f6ebe5b8e38.md

Source sentence:
Set `name` to `kill monster`, set `button text` to an array with three `Go to town square` strings, set `button functions` to an array with three `goTown` variables, and set `text` to `The monster screams Arg! as it dies. You gain experience points and find gold.`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34755/en-ptbr/132#1221665

Source sentence:
Your fifth `locations` value should have a `text` property with the value `The monster screams Arg! as it dies. You gain experience points and find gold.`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34755/en-ptbr/132#1221693

Source file: 62a8f06fb318666fef69f91e.md

Source sentence:
Change the double quotes around the string `The monster screams Arg! as it dies. You gain experience points and find gold.` to single quotes `'`, then add double quotes around `Arg!`.

Crowding string URL that starts the code block:
https://freecodecamp.crowdin.com/translate/690087755819f2f67b26dbee3be0eb53/34471/en-ptbr/132#1212629

Affected Page

I don’t think it has been published yet

Your code

N/A

Expected behavior

To have code blocks not broken in more than one translation string in Crowdin. These broken code blocks don’t seem to be intentional, and don’t help the translator to understand the context.

Screenshots

As an example of code block broken into multiple translation strings in Crowdin, see the images below that correspond to the source string Change the double quotes around the string `The monster screams Arg! as it dies. You gain experience points and find gold.` to single quotes `'`, then add double quotes around `Arg!`.

Captura de tela de 2022-10-07 11-11-22 Captura de tela de 2022-10-07 11-11-28 Captura de tela de 2022-10-07 11-11-41

System

  • Device: Laptop
  • OS: Arch Linux
  • Browser: Firefox
  • Version: 105.0.2

Additional context

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ieahleencommented, Oct 12, 2022

Crowdin breaks by sentence, it doesn’t make any distinction on text inside a code block.

The global fix would be to find a way to not break strings if the punctuation is inside code blocks. (between <code> and </code>)

This should be the file that contains the segmantation rules https://github.com/freeCodeCamp/crowdin-config/blob/main/segmentation/segmentation.srx

I (or someone else) will change the segmentation rules of each file adding specific rules. A global fix would be awesome.

This is the documentation given by crowdin https://support.crowdin.com/custom-segmentation/

0reactions
ieahleencommented, Oct 12, 2022

This doesn’t work.

                <rule break="no">
                    <beforebreak>\u003Ccode\u003E[a-zA-Z !.'"]+</beforebreak>
                    <afterbreak>[a-zA-Z !.'"]+\u003C/code\u003E</afterbreak>
                </rule>

                <rule break="no">
                    <beforebreak></beforebreak>
                    <afterbreak>[a-zA-Z !.'"]+\u003C/code\u003E</afterbreak>
                </rule>

                <rule break="no">
                    <beforebreak>\u003Ccode\u003E[a-zA-Z !.'"]+</beforebreak>
                    <afterbreak></afterbreak>
                </rule>

And also this doesn’t work

                <rule break="no">
                    <beforebreak>\u0060[a-zA-Z !.'"]+</beforebreak>
                    <afterbreak>[a-zA-Z !.'"]+\u0060</afterbreak>
                </rule>

                <rule break="no">
                    <beforebreak></beforebreak>
                    <afterbreak>[a-zA-Z !.'"]+\u0060</afterbreak>
                </rule>

                <rule break="no">
                    <beforebreak>\u0060[a-zA-Z !.'"]+</beforebreak>
                    <afterbreak></afterbreak>
                </rule>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Questions | Crowdin Documentation
How do I handle duplicates in Crowdin Enterprise? Your project might contain duplicate strings, especially if you're translating several branches. A master ...
Read more >
Code::Blocks' translation
A few precisions for using translated menu strings in C::B. For users of translations only : Download the .mo format file in the...
Read more >
Localization — TYPO3 Explained 10.4 documentation
Punctuation marks must be included in the localized string – including trailing marks – as different punctuation marks (e.g. "?" and "¿") may...
Read more >
The Inform Designer's Manual - Northwestern Computer Science
ticle; proper nouns; the short_name of an object; invent strings and ... In two places where dictionary words often appear, the name slot...
Read more >
gitea/CHANGELOG.md at main - Gitea: Git with a cup of tea
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found