Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Translation files cannot exceed 65536 bytes #1018

@Aletor93

Description

@Aletor93

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions