[Interest] Translating JSON files

Thiago Macieira thiago.macieira at intel.com
Mon Jun 17 21:49:40 CEST 2019


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.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel System Software Products






More information about the Interest mailing list