Translations on Mac (was Translations)

René J.V. Bertin rjvbertin at gmail.com
Sat Sep 9 20:00:09 UTC 2017


On Sunday September 10 2017 07:22:40 Ben Cooksley wrote:

>The only way to my knowledge of doing this on MacOS is to include them
>within the .app bundle.
>This is a limitation imposed by Qt and applies to all resources which
>are accessed using QStandardPaths.

Can you show which QSP locations point into the application bundle?!

Here's the output from stock qtdiag 5.9.1 for Mac:

Standard paths [*...* denote writable entry]:
  DesktopLocation: "Desktop" */Users/RB/Desktop*
  DocumentsLocation: "Documents" */Users/RB/Documents*
  FontsLocation: "Fonts" */Users/RB/Library/Fonts* /Library/Fonts /System/Library/Fonts
  ApplicationsLocation: "Applications" */Users/RB/Applications* /Applications
  MusicLocation: "Music" */Users/RB/Music*
  MoviesLocation: "Movies" */Users/RB/Movies*
  PicturesLocation: "Pictures" */Users/RB/Pictures*
  TempLocation: "Temporary Items" */var/folders/x/y/T*
  HomeLocation: "Home" */Users/RB*
  AppLocalDataLocation: "Application Support" */Users/RB/Library/Application Support/QtProject/qtdiag* /Library/Application Support/QtProject/qtdiag /usr/local/qt/5b/5.9.1/clang_64/bin
  CacheLocation: "Caches" */Users/RB/Library/Caches/QtProject/qtdiag* /Library/Caches/QtProject/qtdiag
  GenericDataLocation: "Application Support" */Users/RB/Library/Application Support* /Library/Application Support
  RuntimeLocation: "Application Support" */Users/RB/Library/Application Support*
  ConfigLocation: "Preferences" */Users/RB/Library/Preferences*
  DownloadLocation: "Downloads" */Users/RB/Downloads*
  GenericCacheLocation: "Caches" */Users/RB/Library/Caches* /Library/Caches /System/Library/Caches
  GenericConfigLocation: "Preferences" */Users/RB/Library/Preferences*
  AppDataLocation: "Application Support" */Users/RB/Library/Application Support/QtProject/qtdiag* /Library/Application Support/QtProject/qtdiag /usr/local/qt/5b/5.9.1/clang_64/bin
  AppConfigLocation: "Preferences" */Users/RB/Library/Preferences/QtProject/qtdiag*


Putting everything in the app bundle is a condition imposed by Apple's app store rules, not by Qt and no QSP locations point into the app bundle.
There's a very simple reason for that: app bundles are relocatable, and QSP locations are all returned as absolute paths. A future Qt version will have a modified QSP::findExecutable() which can provide the path to the bundle exec of any foo.app known by LaunchServices but that's the only case I know of where QSP will return a location inside an app bundle.

Qt does have a deployment utility to "bundle up" an application and I presume that will work with their own translation files. AFAIK those used by KI18n are different. I suppose the people behind the Kate, digiKam and KDevelop builds for Mac know better (than I do) how they bundle the translation files and get KI18n to find them inside the app bundle.

Also do not forget that not all KF5 applications are built as app bundles: many helper applications and daemons are built as regular executables. Some of them can post GUIs or generate other forms of translatable output.

This is what an extended QStandardPaths with support for XDG-compliant locations could output - it is still my intention to make another attempt to upstream such a patch:

Standard paths [*...* denote writable entry]:
        - QStandardPaths is in XDG/Freedesktop compliant mode -
  DesktopLocation: "Desktop" = */Users/RB/Desktop*
  DocumentsLocation: "Documents" = */Users/RB/Documents*
  FontsLocation: "Fonts" = */Users/RB/Library/Fonts* /Library/Fonts /System/Library/Fonts
  ApplicationsLocation: "Applications" = */Users/RB/.local/share/applications* /Users/RB/Applications /opt/local/share/applications /Applications
  MusicLocation: "Music" = */Users/RB/Music*
  MoviesLocation: "Movies" = */Users/RB/Movies*
  PicturesLocation: "Pictures" = */Users/RB/Pictures*
  TempLocation: "Temporary Items" = */var/folders/X/Y/T*
  HomeLocation: "Home" = */Users/RB*
  DataLocation: "Application Support" = */Users/RB/.local/share/QtProject/qtdiag* /Users/RB/Library/Application Support/QtProject/qtdiag /Library/Application Support/QtProject/qtdiag /opt/local/share/QtProject/qtdiag /opt/local/libexec/qt5/bin/
  AppLocalDataLocation: "Application Support" = */Users/RB/.local/share/QtProject/qtdiag* /Users/RB/Library/Application Support/QtProject/qtdiag /Library/Application Support/QtProject/qtdiag /opt/local/share/QtProject/qtdiag /opt/local/libexec/qt5/bin/
  CacheLocation: "Caches" = */Users/RB/.cache/QtProject/qtdiag* /Users/RB/Library/Caches/QtProject/qtdiag /Users/RB/.cache /Library/Caches/QtProject/qtdiag
  GenericDataLocation: "share" = */Users/RB/.local/share* /Users/RB/Library/Application Support /opt/local/share /Library/Application Support
  RuntimeLocation: "runtime-bertin" = */var/folders/X/Y/T/runtime-bertin* /Users/RB/Library/Application Support
  ConfigLocation: ".config" = */Users/RB/.config* /Users/RB/Library/Preferences /opt/local/etc/xdg
  DownloadLocation: "Downloads" = */Users/RB/Downloads*
  GenericCacheLocation: ".cache" = */Users/RB/.cache* /Users/RB/Library/Caches /Users/RB/.cache /Library/Caches /System/Library/Caches
  GenericConfigLocation: ".config" = */Users/RB/.config* /Users/RB/Library/Preferences /opt/local/etc/xdg
  AppDataLocation: "Application Support" = */Users/RB/.local/share/QtProject/qtdiag* /Users/RB/Library/Application Support/QtProject/qtdiag /Library/Application Support/QtProject/qtdiag /opt/local/share/QtProject/qtdiag /opt/local/libexec/qt5/bin/
  AppConfigLocation: "Preferences" = */Users/RB/Library/Preferences/QtProject/qtdiag*



More information about the kde-mac mailing list