QOwnNotes icon indicating copy to clipboard operation
QOwnNotes copied to clipboard

[Q] [Package restructure query] QOwnNotes_*.qm files in their own subdirectory?

Open alexanderino opened this issue 2 years ago • 20 comments

Currently, there are 88 files in QOwnNotes-23.11.2.zip's root directory. Of these, 65 are QOwnNotes_*.qm files.

Is it possible to place these files into their own subdirectory? If so, can future QOwnNotes-*.zip files be updated to reflect this structure? It would clean up the layout and make it easier to locate files such as QOwnNotesPortable.bat.

Thanks and regards,

alexanderino

alexanderino avatar Nov 19 '23 09:11 alexanderino

It would be possible. But it would take several releases and lots of bug reports to get out all the issues that would cause on all the different ways to install QOwnNotes, so I'm not very keen to get to that. 😆

pbek avatar Nov 19 '23 13:11 pbek

Thank you. Let me know if I can help in testing, should you decide to take this on 😃

alexanderino avatar Nov 19 '23 13:11 alexanderino

You can test if the translations are still working if you put them into a folder languages. This folder should already be included (just checked).

pbek avatar Nov 19 '23 13:11 pbek

Then it should be just some creating of the folder and updating https://github.com/pbek/QOwnNotes/blob/6f562243c8fed966c321eb23b3d90768ec190b33/build-systems/github/windows/build-zip.ps1#L23.

pbek avatar Nov 19 '23 13:11 pbek

Hm, but it would also mean for all current users that after the next update they'd have the language files twice... 🤔 😬

pbek avatar Nov 19 '23 13:11 pbek

You can test if the translations are still working if you put them into a folder languages. This folder should already be included (just checked).

I don't have that folder, and my copy of the 23.11.2 archive does not either. Anyway, I created it and moved the QM files into it. The portable BAT froze for a few seconds, after which QOwnNotes started up properly. 66 languages are listed, so I changed to another language and restarted manually. This was successful. image

Switching back to English: image

So, it appears this works!

Hm, but it would also mean for all current users that after the next update they'd have the language files twice... 🤔 😬

That is always a concern. Perhaps it could be included in the release notes?

alexanderino avatar Nov 19 '23 14:11 alexanderino

Thank you for testing and confirming...

That is always a concern. Perhaps it could be included in the release notes?

I don't think that more than 2% of people are reading them and 1% of them would really want to act on them. I usually try to do everything automatically, but I don't really want to start deleting files, because of portable-mode...

pbek avatar Nov 21 '23 05:11 pbek

66 languages are listed

they are always listed, this list is hardcoded. the question is if the actual language is shown in the user interface. english is the default language and has no translation files

can you please try at least two languages that are not english?

pbek avatar Nov 21 '23 05:11 pbek

Sure. Here's German: image

Ukrainian: image

Greek: image

By the way, I've searched my drive and found that other QT-based programs store their translations in subdirectories such as i18n, language, languages, translation and translations.

alexanderino avatar Nov 21 '23 19:11 alexanderino

Thank you... Storing them somewhere else is not the big issue. Transitioning to that is.

pbek avatar Nov 21 '23 19:11 pbek

Just an update on this matter: over the last few months, I've tried out other interface languages with the lanugage files residing in the languages sub-directory. These are portable installs on three different machines running Win10 and Win11. It worked flawlessly without issues at all times.

alexanderino avatar Apr 30 '24 01:04 alexanderino

Thank you. 😉

pbek avatar Apr 30 '24 12:04 pbek

Hm, but it would also mean for all current users that after the next update they'd have the language files twice... 🤔 😬

How about adding into build-zip.ps1 a DEL /Q-type command to remove any QOwnNotes_*.qm files in the root directory?


Edit: I tested a portable version with duplicate language files, both in the root directory and languages. Tested around 6 languages, couldn't notice any problems.

alexanderino avatar May 20 '24 00:05 alexanderino

I have a little bit of fear trying to remove files on the user end, because I don't know what the user has put there... 😅

pbek avatar May 20 '24 05:05 pbek

I can understand 😀 Hopefully no one has saved anything — let alone anything important — with a QM extension in the program's root directory!

alexanderino avatar May 20 '24 05:05 alexanderino

If you want, you can create a pull request, and I'll think about it.

pbek avatar May 20 '24 09:05 pbek

I have very little experience with Git and pull requests 😬 However, I've had a look at the process. Once I perform a bit of testing with the modified batch file and it's successful, I'll push through to creating the PR.

alexanderino avatar May 20 '24 09:05 alexanderino

Thank you. Also keep in mind that the update script will be deployed with a usual update too. So it is only active after a 2nd update. If the update script breaks, it's game over. Everyone needs to do a manual download and setup everything new! So whatever you do in the update script, it must not break the update process or the script itself!

The command needs to work from Windows XP to Windows 11!

pbek avatar May 20 '24 09:05 pbek

Yes, I will perform due diligence to ensure it works as expected 😀 What do you think of this approach?:

  1. unzip the update over the existing location
  2. create a languages directory
  3. move all .qm files into languages

During a normal update, any custom .qm files with the same name(s) as those in the update package will be overwritten anyway. So this should be safe from a user's perspective.

Edit: now that I've given it a bit more thought, the older QM files will overwrite the newer ones, because the new QM files will already be inside a languages directory inside the update, yes? So the above approach won't work, but this would:

  1. store the new QM files at the top level inside the archive
  2. unzip the update over the existing location, overwriting the existing QM files with the same names
  3. create a languages directory
  4. move all .qm files into languages

Thoughts?

alexanderino avatar May 20 '24 10:05 alexanderino

Source code

  • App needs to be able to read language files also from languages folder (inside the zip file)

Build process

  • Language files need to be placed in languages folder

Update script

  • Remove language files (and just them) in app directory if they exist
    • Keep in mind that the script will run at every update process!

pbek avatar May 20 '24 17:05 pbek