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

Translation files cannot exceed 65536 bytes #1018

Open
Aletor93 opened this issue Aug 7, 2024 · 1 comment
Open

Translation files cannot exceed 65536 bytes #1018

Aletor93 opened this issue Aug 7, 2024 · 1 comment

Comments

@Aletor93
Copy link
Contributor

Aletor93 commented Aug 7, 2024

Observed behavior

With a translation file from 65536 bytes, I don't observe any error on application start-up.

But with an higher size, the application triggers 2 kind of errors:

SyntaxError: Unexpected token (1:60927) while parsing /datatools-build/i18n/french.yml while parsing file: /datatools-build/i18n/french.yml
    at DestroyableTransform.end [as _flush] (/datatools-build/node_modules/insert-module-globals/index.js:114:21)
    at DestroyableTransform.prefinish (/datatools-build/node_modules/readable-stream/lib/_stream_transform.js:138:10)
    at DestroyableTransform.emit (events.js:400:28)
    at prefinish (/datatools-build/node_modules/readable-stream/lib/_stream_writable.js:619:14)
    at finishMaybe (/datatools-build/node_modules/readable-stream/lib/_stream_writable.js:627:5)
    at endWritable (/datatools-build/node_modules/readable-stream/lib/_stream_writable.js:638:3)
    at DestroyableTransform.Writable.end (/datatools-build/node_modules/readable-stream/lib/_stream_writable.js:594:41)
    at DuplexWrapper.onend (/datatools-build/node_modules/readable-stream/lib/_stream_readable.js:577:10)
    at Object.onceWrapper (events.js:519:28)
    at DuplexWrapper.emit (events.js:412:35) {
  type: 'syntax',
  filename: '/datatools-build/i18n/french.yml',
  stream: [Labeled]
}

Or after another certain size (I didn't ran the test):

[ParseMore [Error]: Malformed inline YAML string ('Ceci remplacera toutes les données actives de l éditeur GTFS po).] {
  parsedLine: 1564,
  snippet: "confirmLoad: 'Ceci remplacera toutes les données actives de l éditeur GTFS po"
}

There is no error on this line, expected its size if I refer to this. But the English version is already about 261 characters long, where our is 329.

Expected behavior

The size for a translation file shouldn't be an issue.

The French language requires more characters to write the same thing as in English.

Also, with feature addition over time (and the need to translate more strings) will raise the errors.

Steps to reproduce the problem

Generate a translation file with a size higher than 65536 bytes.

Any special notes on configuration used

n/a

Version of datatools-ui and datatools-server if applicable (exact commit hash or branch name)

datatools-ui: f256f0f
datatools-server: 8eda62515dcb1dc7eea728e07ae77f30ce60519e

@miles-grant-ibigroup
Copy link
Contributor

This is a mastarm bug. It's trying to load the entire translation file into a buffer with an undefined size. If the file doesn't fit into the buffer, things go south. Sometimes you get lucky and your OS allocates a buffer large enough. Either way this is not a good solution and we should prioritize moving away from mastarm. If you'd like to try your luck, here is the bug: #865

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants