The compile command transforms all Cyrillic text into Unicode sequences, which greatly increases the size of the code.

english text 9kb, russian 40kb.

If i keep my text in cyrillic, file size will be 10 kb

2.7.37.0.2Hey @dimensi,
this seems to be upstream issue: https://github.com/babel/babel/issues/4909
I think we could at least force UTF-8 characters in message catalogs. Want to take a look and submit a PR?
@tricoder42
Honestly, I was already thinking about pr, but I didn鈥檛 figure out where the code in general gets the text and is saved. So no matter how much I want, I can鈥檛 provide pr (
I believe we should add it here:
https://github.com/lingui/js-lingui/blob/master/packages/cli/src/api/compile.js#L172
but I'm not sure if jsonCompatibleStrings option is supported in babel-generator. The option is mentioned for docs in @babel/generator.
If not, we have to update the package and check if it works with babel 6 as well. Otherwise it's a breaking change and we have to wait for v3.
@tricoder42, I try set this property, it's not help.
this options from 6.19
@tricoder42 I read the entire issue of the link you gave. Unfortunately, only 7 versions of babel-generator can fix this. Need add
{ minified: true,
jsescOption: {
minimal: true
}
}
My temporary solution
const fs = require('fs')
const path = require('path')
const pathToFile = path.join(__dirname, 'src/locales/ru/messages.js');
const file = fs.readFileSync(pathToFile, 'utf8')
const r = /\\u([\d\w]{4})/gi
fs.writeFileSync(pathToFile, file.replace(r, function (match, grp) {
return String.fromCharCode(parseInt(grp, 16))
}))
@tricoder42 any news?
The only news related to this issue is that the next version of LinguiJS is going to use Babel 7. I really don't know how to solve it in Babel 6.
Also have this problem. How I can help to fix it?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
waiting for this!
@max-mykhailenko Reading comments above, isn't it already fixed in Babel 7? Have you tried the latest LinguiJS version?
@tricoder42 Oh, I found that yesterday you released 3.0. Is the problem fixed there?
Update. Currently I use "@lingui/cli": "2.9.2" and problem still there
Please try to upgrade and check. There's also a codemod which makes the upgrade much easier. Unforutnately I don't have any source code with cyrillic
@tricoder42 May I ask to send me link to codemod? Nevermind, https://www.npmjs.com/package/@lingui/codemods
Alright, feel free to open a new issue with updated info if the problem still persists
Most helpful comment
Please try to upgrade and check. There's also a codemod which makes the upgrade much easier. Unforutnately I don't have any source code with cyrillic