Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cinnamon-dynamic-wallpaper@TobiZog: Add translation template #560

Merged
merged 1 commit into from
Feb 4, 2024

Conversation

rcalixte
Copy link
Member

@rcalixte rcalixte commented Feb 4, 2024

@rcalixte rcalixte merged commit a2415b4 into linuxmint:master Feb 4, 2024
1 check passed
@rcalixte rcalixte deleted the add_pot branch February 4, 2024 15:42
@TobiZog
Copy link
Contributor

TobiZog commented Feb 4, 2024

Hi!

I want to translate the items in the .glade file. But the cinnamon-spices-makepot ignores the Glade file. Do you know why?

@rcalixte
Copy link
Member Author

rcalixte commented Feb 4, 2024

Hi!

I want to translate the items in the .glade file. But the cinnamon-spices-makepot ignores the Glade file. Do you know why?

It just needs to be configured to include those files. As of right now, I believe it checks for gettext strings in Python and JavaScript files. Let me take a look and see what we can do for you here.

@rcalixte
Copy link
Member Author

rcalixte commented Feb 4, 2024

@TobiZog We just need to test with the UI to see if the strings are properly translated. If so, I'll get started on the modified script so that it will be here for future updates.

@TobiZog
Copy link
Contributor

TobiZog commented Feb 4, 2024

@TobiZog We just need to test with the UI to see if the strings are properly translated. If so, I'll get started on the modified script so that it will be here for future updates.

I will test it.

@TobiZog
Copy link
Contributor

TobiZog commented Feb 4, 2024

Ok, I try to test it. So, at first, I want to test the basic translation. I created a translation file for German, changed the system language to "German, Germany" and add it to the folder. I used your Spanish file. But the description in the "Extension" window doesn't change. Did I miss something?

image
image

Here is the config file:

# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-04 19:17+0100\n"
"PO-Revision-Date: 2024-02-04 20:00+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 3.4.2\n"

#: 5.4/extension.js:127
msgid "Open settings"
msgstr "Einstellungen öffnen"

#. metadata.json->name
msgid "Cinnamon Dynamic Wallpaper"
msgstr "Cinnamon Dynamic Wallpaper"

#. metadata.json->description
msgid ""
"Cinnamon extension for dynamic desktop backgrounds based on time and location"
msgstr ""
"Cinnamon Erweiterung für dynamische Desktop Hintergründe basierend auf Zeit und Ort."

@rcalixte
Copy link
Member Author

rcalixte commented Feb 4, 2024

Ok, I try to test it. So, at first, I want to test the basic translation. I created a translation file for German, changed the system language to "German, Germany" and add it to the folder. I used your Spanish file. But the description in the "Extension" window doesn't change. Did I miss something?

The compiled .mo files need to be installed. This is where the translations are actually pulled from. You can run ./cinnamon-spices-makepot cinnamon-dynamic-wallpaper@TobiZog -i to test and then ./cinnamon-spices-makepot cinnamon-dynamic-wallpaper@TobiZog -r once you're done.

@TobiZog
Copy link
Contributor

TobiZog commented Feb 4, 2024

After a little bit of testing, it worked now!

For future developer, who find this. You have to add this to your python code:

UUID = "cinnamon-dynamic-wallpaper@TobiZog" # Add your UUID

localeDir = os.path.expanduser("~") + "/.local/share/locale"
locale.bindtextdomain(UUID, localeDir)

class Window:
    def __init__(self):
        self.builder = Gtk.Builder()
	self.builder.set_translation_domain(UUID)
	self.builder.add_from_file(self.view_model.GLADE_URI)
        self.builder.connect_signals(self)

@rcalixte
Copy link
Member Author

rcalixte commented Feb 5, 2024

You can take a look at the code in this PR too. You may still need to create the helper function. Feel free to open the change for this extension when you're ready!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants