microsoft / vscode-l10n

MIT License
66 stars 14 forks source link

l10n-dev | Produce a formatted, sorted and auto commented bundle.l10n.json file #150

Open FALLAI-Denis opened 11 months ago

FALLAI-Denis commented 11 months ago

Hi,

The l10n-dev export command produces a bundle.l10n.json file which is not actually used by l10n but which serves as a reference for constructing bundle.l10n.<locale>.json files.

Apparently, the bundle.l10n.json file is built based on the discovery of the texts used by the vscode.l10n.t function and the text strings are saved, without formatting, in the order they appear in TypeScript or JavaScript files. Any modification (moving a portion of code) in the TypeScript or JavaScript files has an impact on the construction of the bundle.l10n.json file.

The work of creating and especially maintaining bundle.l10n.<locale>.json files would be easier if the bundle.l10n.json file was formatted and sorted on key texts, possibly with options to enable formatting and / or sorting.

Formatted: this can be an effect of working on Windows platform... CRLF expected instead of LF, add replace("\r(\n)?","\r\n") on result of JSON.stringify? use "\t" insteadd of 2 as space value? See:

Sorted: add a sort on key of mergedJson in getL10nJson?

And perhaps add source path and source line number, (position.row), column number, (position.column), as a automatic comment.

Thanks.