[Interest] Translating JSON files

Mitch Curtis mitch.curtis at qt.io
Mon Jun 17 22:18:23 CEST 2019


> -----Original Message-----
> From: Tom Isaacson <Tom.Isaacson at navico.com>
> Sent: Monday, 17 June 2019 10:13 PM
> To: Mitch Curtis <mitch.curtis at qt.io>; Thiago Macieira
> <thiago.macieira at intel.com>; interest at qt-project.org
> Subject: RE: [Interest] Translating JSON files
> 
> -----Original Message-----
> From: Interest <interest-bounces at qt-project.org> On Behalf Of Mitch Curtis
> Sent: Tuesday, June 18, 2019 8:02 AM
> To: Thiago Macieira <thiago.macieira at intel.com>; interest at qt-project.org
> Subject: Re: [Interest] Translating JSON files
> 
> > I was hoping to avoid having to duplicate the file, as it would be a
> maintenance nightmare. Though I guess there's not much I can do in JSON
> besides doing some funky string-based syntax to mark translatable strings:
> 
> >     "displayText": "tr(Some user-facing text)",
> 
> > I can't think of a better solution though. :/ Switching file formats is also not
> an option at this point.
> 
> I make the text an array of structs, one for each language:
> 
>     "displayText":
>     [
>         { "language": "en", "text": "English" },
>         { "language": "fr", "text": "Francais" }
>     ]

That's not a bad idea...

So I guess you bypass lupdate and lrelease altogether with this approach?

> Tom Isaacson



More information about the Interest mailing list