[Interest] Translating JSON files

Tom Isaacson Tom.Isaacson at navico.com
Mon Jun 17 22:12:48 CEST 2019


-----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" }
    ]

Tom Isaacson



More information about the Interest mailing list