vslavik / poedit

Translations editor for Mac, Windows and Unix
https://poedit.net
MIT License
1.71k stars 274 forks source link

POT files are not previewed with Spotlight on macOS 12 #762

Open DAnn2012 opened 2 years ago

DAnn2012 commented 2 years ago

Hello @vslavik ,

I noticed that the contents of POT files are not previewed with Spotlight, while the contents of PO files are shown.

I'm using Poedit 3.1.1 on macOS Monterey 12.4 (21F79) on a Mac with Apple M1.

Thanks.

vslavik commented 2 years ago

Please read this document (which GitHub asked you to do when you created this issue), follow the instructions therein and provide the missing detailed information, including any relevant files and detailed steps to reproduce. Thanks!

DAnn2012 commented 2 years ago

Hello @vslavik ,

thank you for the reply.

I think I have located the reason why the POT file content is not showing in previews on my Mac, this is due to Quick Look.

After searching the web, I found the following command: qlmanage -m and this is an extract from the result of this command:

server: living for 411s (3 requests handled) - instant off: yes - arch: ARM64 - user id: 501
memory used: 0 MB (595616 bytes) - used descriptors: 19/2560
last burst: during 0.007s - 1 requests - 0.000s idle
plugins:
...
  com.microsoft.powerpoint.pot -> /System/Library/QuickLook/Office.qlgenerator (46 - loaded)
...
  org.oasis.xliff -> /Applications/Poedit.app/Contents/Library/QuickLook/PoeditQuicklook.qlgenerator (6476)
...
  net.poedit.po -> /Applications/Poedit.app/Contents/Library/QuickLook/PoeditQuicklook.qlgenerator (6476)
...
  org.oasis-open.xliff -> /Applications/Poedit.app/Contents/Library/QuickLook/PoeditQuicklook.qlgenerator (6476)
...
  net.poedit.pot -> /Applications/Poedit.app/Contents/Library/QuickLook/PoeditQuicklook.qlgenerator (6476)

So, I think POT files, even though in my Mac they are regularly associated with Poedit as the default application, for Quick Look they are considered PowerPoint Templates (com.microsoft.powerpoint.pot) and try to open them exclusively for preview with that Office.qlgenerator.

I don't have PowerPoint in my Mac, but I think it is possible to open real PowerPoint template files with other applications I have installed (like Keynote and NeoOffice).

I don't know if I should use the commands to reset the Quick Look server's information (qlmanage -r), because I don't know if this could cause problems with previews of other document types.

For the moment, I have found that using this command from the Terminal: qlmanage -p -c net.poedit.pot filename.pot I can at least preview a single Poedit POT file.

Alternatively, by temporarily renaming the file from POT to PO, I am shown the preview directly from QuickLook, as a Poedit PO file.

I ask you and other Poedit users if anyone has encountered the same problem and how they have definitively solved it.

Thanks.

vslavik commented 1 year ago

Sorry, I should have realized this is about Office.qlgenerator myself, but I all too happily forgot about it. It, and macOS insistence that .pot files are com.microsoft.powerpoint.pot was always source of issues (any conflicting UTI declaration is just ignored), but previews did work in macOS 10.14, but indeed don't seem to in macOS 12.

I hope, but am not sure, that it will be possible to fix by migrating to the new Quick Look API introduced in macOS 10.15 and 12. It is plausible that new-style preview extensions will take priority over qlgenerators. If not, then there's probably nothing we can do.

vslavik commented 1 year ago

I'm less optimistic about the new API helping now. Apparently, nothing builtin uses it and everything qlmanage shows is still qlgenerators. Here's an Apple person saying that they're surprised this ever worked (for another filetype in a similar situation): https://developer.apple.com/forums/thread/124857 And this project encountered this issue for many filetypes starting with Catalina: https://github.com/sbarex/SourceCodeSyntaxHighlight#file-format-management