Hello there,
I have recently created a python extension for Nemo to add support for KDE Connect and I would like to add translation to it and maybe a way to package it to a .deb file.
Could someone help with that, since I didn't find anything on this forum?
Thanks in advance!
Translate Nemo extension (+ Packaging)
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
Translate Nemo extension (+ Packaging)
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Translate Nemo extension (+ Packaging)
Is there no one that can help me with this?
Re: Translate Nemo extension (+ Packaging)
I have never wrriten and packaged Python code but a DuckDuckGo search for package python extension to deb file resulted in https://stackoverflow.com/questions/174 ... b#17402676 as the first hit. Does this or any of the other search results help?
Re: Translate Nemo extension (+ Packaging)
Thanks for you answer!
I got it working just yesterday actually and just saw your answer. I'm, sorry for not seeing it earlier, i think I have to change the Email settings of the LM forum. I looked at your link, but I don't think it will help with nemo extensions, but I will try that. Thanks anyway!
This is my current solution, for anyone having the same issue:
I used PoEdit to make a
The directory structure looks as follows:
I used this reference to get the basics down for gettext:
The following code will be used to set the text domain for gettext and has to be added to the beginning every function of the extension class you want to use the gettext.gettext function in.
Then you can use
As an example, here is the extension I made: https://github.com/JoeJoeTV/nemo-extension-kdeconnect
I got it working just yesterday actually and just saw your answer. I'm, sorry for not seeing it earlier, i think I have to change the Email settings of the LM forum. I looked at your link, but I don't think it will help with nemo extensions, but I will try that. Thanks anyway!
This is my current solution, for anyone having the same issue:
I used PoEdit to make a
.pot
file for my extension and the translated .po
files, that I put in a subfolder of the one, the extension will be in and then proceeded to add the code.The directory structure looks as follows:
Code: Select all
/usr/share/namo-python/extensions
+<extension>.py
+<extension>/
+locale/
+en/ (The language code)
+LC_MESSAGES/
+<extension>.mo (The actual translation for the language)
Code: Select all
import gettext, locale
locale_dir = os.path.dirname(os.path.realpath(__file__)) + "/<extension>/locale"
locale_domain = "<extension>"
Code: Select all
# Setup translation
locale.setlocale(locale.LC_ALL, "")
gettext.bindtextdomain(locale_domain, locale_dir)
gettext.textdomain(locale_domain)
_ = gettext.gettext
_(<text>)
(the function is gettext.gettext
, but it is often used as _
for ease of use, i think)As an example, here is the extension I made: https://github.com/JoeJoeTV/nemo-extension-kdeconnect