[Interest] Translating JSON files
mitch.curtis at qt.io
Tue Jun 18 09:49:25 CEST 2019
> -----Original Message-----
> From: Interest <interest-bounces at qt-project.org> On Behalf Of Thiago
> Sent: Monday, 17 June 2019 11:40 PM
> To: interest at qt-project.org
> Subject: Re: [Interest] Translating JSON files
> On Monday, 17 June 2019 14:18:33 PDT Mitch Curtis wrote:
> > The thing is that I have other data in the file that doesn't need to
> > be translated, so copying them would require keeping each file in
> > sync. The file itself is edited often fairly regularly to add new data
> > (both translatable and non-translatable).
> Sounds like a design flaw. I suggest you split that up.
I don't think so - I mean, it would be easier to translate if it was split up, but it would make everything else harder.
I like this design.
> A simple solution is to *not* have the translations in the .json files, but only
> US-ASCII English versions. Then you extract those strings into a proper .ts or
> .pot file, translate them using your preferred tool, and *keep* the
> translations there. At runtime, you translate using:
> // .toUtf8() would be strictly speaking more correct, but if you restrict
> // to US-ASCII, you gain a bit in performance
> > I do like the idea of generating .ts files from JSON...
> You can play with the examples/corelib/serialization/convert tool and an XSL-
> T stylesheet. Or write your own extract tool, of course.
> Or you may want to generate a dummy .cpp file with your extracted strings
> so you can pass it to lupdate or msgfmt, so it handles fuzzying and merging of
> new strings into an already-translated file.
These are all great ideas, and that last part especially - sounds like something I would want to have.
> Thiago Macieira - thiago.macieira (AT) intel.com
> Software Architect - Intel System Software Products
> Interest mailing list
> Interest at qt-project.org
More information about the Interest