desktoptojson and list properties / i18n of JSON files

Albert Astals Cid aacid at kde.org
Wed Nov 19 22:00:57 GMT 2014


El Dimecres, 19 de novembre de 2014, a les 18:46:28, Milian Wolff va escriure:
> On Wednesday 19 November 2014 17:30:28 Burkhard Lück wrote:
> > Am Mittwoch, 19. November 2014, 01:28:51 schrieb Kevin Funk:
> > > On Wednesday 19 November 2014 00:09:25 Albert Astals Cid wrote:
> > > > El Dimarts, 18 de novembre de 2014, a les 23:01:14, Alex Merry va
> > 
> > escriure:
> > > > > On Tuesday 18 November 2014 23:45:56 Albert Astals Cid wrote:
> > > > > > I didn't even know we were using json now. Why did we change from
> > > > > > .desktop
> > > > > > file to .json ones? What's the benefit? Seems like .desktop files
> > > > > > did
> > > > > > their
> > > > > > job good enough and we have all the tooling available already.
> > > > > 
> > > > > Because that's what Qt uses - Qt5 plugins have JSON metadata as
> > > > > standard,
> > > > > meaning it's all in one file (the JSON is embedded in the plugin,
> > > > > although
> > > > > it can be read without loading the plugin).
> > > > 
> > > > And Qt introduced a technology without making it translatable? What
> > > > fields
> > > > do we need to make translatable? Can somebody point me to such a .json
> > > > file
> > > > we'd like to translate?
> > > 
> > > Here's one: http://pastebin.kde.org/p4p38fqr1
> > > 
> > > That's kdevpatchreview.json, generated from kdevpatchreview.desktop via
> > > kcoreaddons_desktop_to_json(...) during the CMake run.
> > 
> > But the kdevpatchreview.desktop is installed nevertheless and is
> > apparently
> > used to get the translations for Name + Comment/Description.
> > Having german translations for Name + Comment/Description only in
> > kdevpatchreview.json at build time, but removed after installation in the
> > installed kdevpatchreview.desktop file makes them untranslated for me.
> 
> And if the .desktop is not installed at all (we do this in other places, and
> would/should do it here too). Are translations then gone alltogether? One
> more reason to get i18n support for .json files.
> 
> > Looks to me like translations are not supported via json files.
> 
> Please check the above. Anyhow, imo it should be our goal to get this
> supported. In the ideal scenario, a plugin would be just a .so installed
> into the right directory. No .desktop, no sycoca cache.
> 
> So again, what is necessary to get this done?

Well, there's two steps about this:

1) Know where the code is that gets the Name/Comment/Description from the json

2) Decide how you want to translate stuff (which may depend on 1)

For 2) there's broadly two options:
2.1: Make the .json file have the translations and make sure the code from 1 
reads it properly
2.2: Make the translations be in the .po and then make the code from 1 read 
the english variant and call i18n(englishText)

2.2 is easier (if possible to change the code in 1 to do it) since it does not 
involve writing back strings to the json file.

Cheers,
  Albert

> 
> Bye





More information about the kde-core-devel mailing list