ionutbortis / gnome-bedtime-mode

Home of the "Bedtime Mode" :zzz: GNOME Shell Extension.
GNU General Public License v3.0
75 stars 12 forks source link

Add i18n support + Spanish translation #9

Closed oscfdezdz closed 3 years ago

oscfdezdz commented 3 years ago

Hi, I've been using this one for a few days now and I find it very useful so here is my contribution 😄

I noticed some scripts under extras/scripts for generating the release package. I've used gnome-extensions command with its options pack and install. The process is:

  1. Generate pot file: xgettext --from-code=UTF-8 --files-from=po/POTFILES --output=po/bedtime.pot

  2. Pack the extension: gnome-extensions pack -f --extra-source=icons --extra-source=modules --extra-source=ui --extra-source=config.js --extra-source=utils.js . --out-dir=./build which also compiles and places the translations like Spanish, under locale/es/LC_MESSAGES/gnomebedtime.mo as well as compiling schemas.

  3. Install it locally: gnome-extensions install -f gnomebedtime@ionutbortis.gmail.com.shell-extension.zip

I'd rather let you decide wether use this way of generating translations or generating .mo files with its command and under locale/ instead po/ as it is in this MR.

Fixes #3

ionutbortis commented 3 years ago

Hi Óscar,

Thank you for your interest in this gnome extension! Also, your contribution is much appreciated and it's a good start in preparing for the next release.

I still need to do some i18n guidelines reading because I'm not very familiar with the best approaches for translating the gnome extensions.

Your changes look fine and are more than welcomed, but I have a small request: Can you edit the pull request in order to merge the changes to the "next-release" branch?

My approach, so far, was to use the "main" branch as stable as possible and all the preparation for the upcoming releases to go into the "next-release" branch.

Thanks! Ionut

oscfdezdz commented 3 years ago

Hi!

It should be targeting "next-release" now.

ionutbortis commented 3 years ago

Nice work! Will ping you if there will be additional Spanish translations due to the changes for the next release.

Thanks!

ionutbortis commented 3 years ago

@oscfdezdz Hi Óscar,

The next version of the Bedtime Mode extension is around the corner and I need your help in translating some new texts to spanish. I also added a romanian translation, it was harder than expected :))

Please use the next-release branch code because that's the place where all the new changes are available. Also, use this branch when creating the pull request.

The po/es.po file has some untranslated texts that were introduced with the changes for enhancement #7.

If you want to test locally your changes just run the scripts/install.sh script and the extension should be packaged with the new translations and installed to your Gnome shell. Just be aware that the script is also trying to restart the gnome shell and if you are on Wayland (Gnome 40+) all your opened windows will be closed. So first, you might wanna save your work before running the install script...

Many thanks!

oscfdezdz commented 3 years ago

I'll have them ready shortly, thanks for the heads up!

oscfdezdz commented 3 years ago

Just be aware that the script is also trying to restart the gnome shell and if you are on Wayland (Gnome 40+) all your opened windows will be closed. So first, you might wanna save your work before running the install script...

I ran the script and I had to log out manually. Here is the output:

$ ./scripts/install.sh 
Calling the build script...
Removing ui temp files and build folder...
Packing the extension...
Package created: /var/home/oscar/Proyectos/gnome-bedtime-mode/build/gnome-bedtime-mode_4.zip
Installing Bedtime Mode extension to local extensions folder...
Disabling Bedtime Mode extension...
Restarting gnome shell...
bs false ""
Enabling Bedtime Mode extension...
ionutbortis commented 3 years ago

If you're using Gnome 3.36 or 3.38, there is no need for logging out, assuming that the shell language is already set to Spanish. The script output looks as expected...

My side note was referring to the fact that Gnome 40+ has no way of restarting and preserving the already opened apps. So if you run the install script on Gnome 40+ it should restart the gnome shell but in the process all your opened apps will be closed.

ionutbortis commented 3 years ago

Thanks again for the translations, you rock!

Also, I added your name (and link to github profile) to the "Translators hall of fame" section from the README page, hope that's alright with you. Hopefully we'll have some other people there :))

oscfdezdz commented 3 years ago

I ran it on gnome-shell 41.rc.1 and it did not restart or close my apps.

EDIT: now that I have reread my previous comment, I did not explain myself as I wanted to 😅

ionutbortis commented 3 years ago

Oh, I get it now, sorry :laughing:

Well, yesterday the extension was not yet tested on Gnome 41, I guess you were the first one to do it :smile: :+1:

Today I did some tests on 41 and the install script ran by you doesn't restart the Gnome shell. The way I coded the restart doesn't seem work on 41, but strangely, works rather fine on 40, 3.36 and 3.38. I'm guessing they dropped some dbus methods, I will ask the folks on the Extensions channel.

I will probably use pkill for restart, that approach seems to somewhat work on all versions. On 40+ you'll have to re-login after a gnome-shell process kill.

Mistery solved :sweat_smile: