> -----Original Message----- > From: Interest <interest-boun...@qt-project.org> On Behalf Of Thiago > Macieira > Sent: Monday, 17 June 2019 9:50 PM > To: interest@qt-project.org > Subject: Re: [Interest] Translating JSON files > > On Monday, 17 June 2019 12:41:07 PDT Mitch Curtis wrote: > > Is there a way to translate data that's not stored in a C++ or QML > > file, like JSON? I have a bunch of user-facing strings in a JSON file > > that will eventually need to be translated, and there doesn't seem to > > be any solution for this. > > Provide multiple JSON files, one for each language, then use QFileSelector to > find the right one, according to language. One of the default selectors is the > value returned by QLocale().name(). > > Converting those JSON files into a format that your translation tool is able > to > open and then back from that is an exercise left to the reader.
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. > -- > Thiago Macieira - thiago.macieira (AT) intel.com > Software Architect - Intel System Software Products > > > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > https://lists.qt-project.org/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest