Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 09-19-2024, 05:07 PM   #1
Coleccionista
Connoisseur
Coleccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to behold
 
Posts: 73
Karma: 11638
Join Date: Aug 2010
Location: Spain
Device: iPad, Kindle Paperwhite, Kobo Libra 2
Lightbulb [Plugin] eplSemantica

Name: eplSemantica
Version: 0.32
Requires: Sigil >= 1.9.0. Tested with integrated Python.

New in 0.32:
  • Polish translation thanks to @bravosx and @BeckyEbook
  • Minor cosmetic fixes

This community has provided a lot of useful tools. I hope someone finds this plugin useful. It will be a little giveback.

eplSemantica enhances the semantic markup of ePub files. It allows users to search for specific HTML tags and replace them with more semantically appropriate alternatives, improving the overall structure and accessibility of ePub documents.

This is for those who care deeply about whether a <cite>, <em>, <i>... is more appropiate and who love to add language codes to any foreign language excerpt in their books. Only they are tired of doing it manually.

Quote:
What if you could see the contents of these tags at a glance and then choose the appropiate replacement in one single swoop?


Installation

1. Download the latest release of eplSemantica from this post.
2. In Sigil, go to "Plugins" > "Manage Plugins".
3. Click "Add Plugin" and select the downloaded eplSemantica zip file.
4. Optionally add a shortcut for the plugin. In any case, you'll find it under Plugins | Edit | eplSemantica.

Notes
The plugin operates on selected XHTML files in the Book Explorer or in all if none is selected.
Usage should be self-explanatory. Most fields have tooltips anyway.
Do not miss the right-click menu in the results table. It's handy!
Please make sure to make a backup copy or restore point before commiting changes. They are irreversible.
Attached Files
File Type: zip eplSemantica.zip (30.7 KB, 12 views)

Last edited by Coleccionista; 10-14-2024 at 01:23 PM.
Coleccionista is offline   Reply With Quote
Old 09-19-2024, 05:10 PM   #2
Turtle91
A Hairy Wizard
Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.Turtle91 ought to be getting tired of karma fortunes by now.
 
Turtle91's Avatar
 
Posts: 3,220
Karma: 19000635
Join Date: Dec 2012
Location: Charleston, SC today
Device: iPhone 15/11/X/6/iPad 1,2,Air & Air Pro/Surface Pro/Kindle PW & Fire
Cool - Thanks!
Turtle91 is offline   Reply With Quote
Advert
Old 09-19-2024, 07:55 PM   #3
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 782
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
This is great.
Sometimes I'll get this silly idea of adding the appropriate language in the code for any extraneous interjections in the book, and that handiwork has always bored me and almost no one cares about it (at least in Poland).

As soon as I find a free moment I'll check it out on the big file with dozens of foreign interjections I recently prepared.
BeckyEbook is offline   Reply With Quote
Old 09-19-2024, 10:37 PM   #4
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,457
Karma: 156982136
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
I tried it on one file with a mix of French, Spanish, Latin and Greek language bits in a English book. It did make it a lot easier to set the language. Not something I will use everyday but still handy to keep in the tool kit.
DNSB is offline   Reply With Quote
Old 09-20-2024, 12:44 PM   #5
bravosx
Zealot
bravosx began at the beginning.
 
Posts: 103
Karma: 10
Join Date: Jun 2014
Location: Poland, Żory
Device: Prestigio PER3464B, Onyx Lynx, Lenovo S5000 i Tab4-8"
@Coleccionista

I translated the es.json file in the eplSemantica\translations folder to Polish. I added my file to this folder next to es.json as pl.json. After adding the plugin to Sigil and trying to run it, I get the following error message, which I have attached below:

Status: failed

Traceback (most recent call last):
File "C:\Program Files\Sigil\plugin_launchers\python\launcher.py", line 142, in launch
self.exitcode = target_script.run(container)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xxxxx\AppData\Local\sigil-ebook\sigil\plugins\eplSemantica\plugin.py", line 577, in run
translator = MemoTraductor(bk.sigil_ui_lang, plugin_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\xxxxx\AppData\Local\sigil-ebook\sigil\plugins\eplSemantica\traductor.py", line 24, in __init__
self.load_translations()
File "C:\Users\xxxxx\AppData\Local\sigil-ebook\sigil\plugins\eplSemantica\traductor.py", line 41, in load_translations
self.translations = json.load(f)
^^^^^^^^^^^^
File "json\__init__.py", line 293, in load
File "json\__init__.py", line 346, in loads
File "json\decoder.py", line 337, in decode
File "json\decoder.py", line 353, in raw_decode
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 5 column 2 (char 130)
Error: Expecting property name enclosed in double quotes: line 5 column 2 (char 130)

Could you check it and possibly modify the plugin so that it can also be used in Polish?

Below is the pl.json file


{
"Keep attributes": "Zachowaj atrybuty",
"Keep attributes:": "Zachowaj atrybuty:",
"Apply to All": "Zastosuj do wszystkich",
"Search for": "Szukaj",
"Replacements by default": "Zastąpienia według",
"Text": "Tekst",
"Switch tag to": "Nowy tag",
"Set lang": "Język",
"Mandatory: Tag to search and occasionally replace": "Obowiązkowe: Znacznik do wyszukania",
"Optional: Attribute to match: class, title, id, etc.": "Opcjonalnie: Atrybut, który tag musi mieć jako klasa lub identyfikator",
"Optional: Match only tags whose attribute value equals this field": "Opcjonalnie: Wartość, jaką musi mieć wybrany atrybut",
"Improved grouping": "Ulepszone grupowanie",
"Clean and normalize text for better grouping of results": "Normalizuj tekst dla lepszego grupowania wyników",
"Limit results to n matches": "Ogranicz wyniki do wybranej liczby",
"All": "Wszystkie",
"Set default tag for replacement": "Wybierz domyślny tag do zastąpienia",
"Two letter code": "Kod dwuliterowy",
"ISO 639 code for the language": "Jest to kod zgodny z ISO 639",
"If checked, the original tag's attributes will be preserved": "W przypadku zamiany atrybuty, które posiadał tag zostaną zachowane",
"Tag:": "Znacznik:",
"Attribute:": "Atrybut:",
"Value:": "Wartość:",
"Limit results": "Ogranicz wyniki",
"Lang:": "Język:",
"Accept": "Akceptuj",
"Process": "Zmiana",
"Search": "Szukaj",
"Yes": "Tak",
"No": "Nie",
"Clear": "Usuń",
"Cancel": "Anuluj",
"Changes are not reversible. Please save your work before proceeding": "Zmiany są nieodwracalne. Proszę zapisać swoją pracę przed kontynuowaniem",
"No changes to process. Please make some changes before processing": "Nie wykryto żadnych zmian. Proszę wybrać zamiennik",
"Set tag to": "Nowy tag",
"Set lang to": "Nowy język",
"Toggle attributes": "Przełącz atrybuty",
"Copy text": "Kopiuj tekst",
"Clear all": "Usuń wsystko",
"Clear selected": "Usuń zaznaczone",
"I searched and searched yet nothing was found. Such is life.": "Szukałem i szukałem, ale nic nie znalazłem. Takie jest życie.",
"Switch Style": "Przełącz styl",
"Light": "Jasny",
"Dark": "Ciemny",
"Default": "Domyślny",
"Default Theme": "Motyw domyślny",
"Settings": "Ustawienia",
"Warning": "Ostrzeżenie",
"Information": "Informacja",
"No Results": "Brak wyników",
"The search found no matching results. Please try a different search or select other files": "Wyszukiwanie nie znalazło niczego, spróbuj innych parametrów lub innych plików",
"Language Codes (comma-separated)": "Kody języków (oddzielone przecinkami)",
"Invalid language code: {code}. Must contain only letters": "Nieprawidłowy kod języka: {code}. Musi zawierać tylko litery",
"Invalid language code: {code}. Must be exactly 2 letters": "Nieprawidłowy kod języka: {kod}. Musi składać się dokładnie z 2 liter",
"Maximum 15 unique language codes allowed. Truncating list": "Dozwolonych maksymalnie 15 unikalnych kodów języków. Lista zostanie obcięta do 15",
"Duplicate codes were removed from the list": "Z listy usunięto zduplikowane kody języków",
"Up to 15 codes. Leave empty to use defaults": "Maksymalnie 15 kodów. Pozostaw puste, aby użyć listy domyślnej"
}

Thank you very much in advance and sorry for my poor English.

Best regards
bravosx

@Coleccionista

Thanks to @KevinH answer, the plugin in Polish works. I simply missed a trivial mistake, but there are so many quotation marks that they shimmer before your eyes.

In post #9 I attached the plugin translation file to Polish.

Thank you and best regards
bravosx

Last edited by bravosx; 09-20-2024 at 01:53 PM.
bravosx is offline   Reply With Quote
Advert
Old 09-20-2024, 01:12 PM   #6
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,156
Karma: 5450818
Join Date: Nov 2009
Device: many
Just a guess but possibly wrong quotes in this line ... at least in comparison to the other lines:

"Search for": „Szukaj”,
KevinH is online now   Reply With Quote
Old 09-20-2024, 01:18 PM   #7
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Yes. My thoughts as well. Looks like the two commas should be replaced with a double-quote character.
DiapDealer is offline   Reply With Quote
Old 09-20-2024, 01:29 PM   #8
bravosx
Zealot
bravosx began at the beginning.
 
Posts: 103
Karma: 10
Join Date: Jun 2014
Location: Poland, Żory
Device: Prestigio PER3464B, Onyx Lynx, Lenovo S5000 i Tab4-8"
Quote:
Originally Posted by KevinH View Post
Just a guess but possibly wrong quotes in this line ... at least in comparison to the other lines:

"Search for": „Szukaj”,
Bingo!
I simply missed such a trivial mistake, but there are so many of these quotation marks that they shimmer before your eyes.

Now it's OK, the Polish language plugin works.

Thank you and best regards
bravosx
bravosx is offline   Reply With Quote
Old 09-20-2024, 01:44 PM   #9
bravosx
Zealot
bravosx began at the beginning.
 
Posts: 103
Karma: 10
Join Date: Jun 2014
Location: Poland, Żory
Device: Prestigio PER3464B, Onyx Lynx, Lenovo S5000 i Tab4-8"
Now it's OK, the Polish language plugin works.

Best regards
bravosx
Attached Files
File Type: zip pl.zip (1.6 KB, 31 views)
bravosx is offline   Reply With Quote
Old 09-20-2024, 02:16 PM   #10
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 782
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
@Bravox: I have a few comments on this translation. I will send you my version via PM soon and we will work out such a translation, which we will send to the plugin author. OK?

@Collectionista: "Cancel" button in the main plugin after the search (in the right bottom) is untranslatable.

My proposal:
Code:
        #self.dbb.addButton(QDialogButtonBox.Cancel)
        self.dbb.addButton(self.tr("Cancel"), QDialogButtonBox.RejectRole)
In logic.py is print after "Search" click:
Code:
print(f"Pasando {len(contador)} resultados a la UI")
I suggest translating this message into English for compatibility.

in table.py missing translation:
Code:
self.filter_input = QLineEdit(placeholderText=self.tr("Search in text..."))

Last edited by BeckyEbook; 09-20-2024 at 02:28 PM.
BeckyEbook is offline   Reply With Quote
Old 09-20-2024, 02:28 PM   #11
bravosx
Zealot
bravosx began at the beginning.
 
Posts: 103
Karma: 10
Join Date: Jun 2014
Location: Poland, Żory
Device: Prestigio PER3464B, Onyx Lynx, Lenovo S5000 i Tab4-8"
Quote:
Originally Posted by BeckyEbook View Post
@Bravox: I have a few comments on this translation. I will send you my version via PM soon and we will work out such a translation, which we will send to the plugin author. OK?
@BeckyEbook
OK. Cieszy mnie, że się moim tłumaczeniem zainteresowałaś i chcesz go poprawić. Jak już kiedyś wspominałem ja nie jestem informatykiem i słabo znam język angielski, na dodatek jestem starej daty.

Serdecznie pozdrawiam
bravosx
bravosx is offline   Reply With Quote
Old 09-20-2024, 02:52 PM   #12
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
I'm not familiar with the translation method going on in this plugin. Can someone please point me in the right direction?

My own plugins require QtLinguist and the standard lupdate and lrelease tools. Unfortunately, PySide6 has completely abandoned/dropped their pyside6-lupdate and pyside6-lrelease tools leaving me to use the (compatible for now) PyQt5 pylupdate and Qt's lrelease to compile them. At least until such time as Qt's lupdate groks python files. I have my doubts it ever will.

So I'm always on the lookout for a replacement for the lupdate/lrelease method. Which frankly, I consider a bit too much for translators to have to jump through hoops to install QtLinguist without downloading/installing the full Qt development package nayway.

Something like this that uses fairly straightforward .json files might interest me.

Thanks!

Last edited by DiapDealer; 09-20-2024 at 02:56 PM.
DiapDealer is offline   Reply With Quote
Old 09-20-2024, 05:00 PM   #13
Coleccionista
Connoisseur
Coleccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to beholdColeccionista is a marvel to behold
 
Posts: 73
Karma: 11638
Join Date: Aug 2010
Location: Spain
Device: iPad, Kindle Paperwhite, Kobo Libra 2
I will update the missing translations and add any additional I receive. Thanks!

@DiapDealer. I didn't want to install QTLinguist and go through what it seemed a quite convoluted process to translate about 20-30 strings tops.
The strings are in English, if the translations folder contains a <langcode>.json file that matches Sigil's UI language it simply loads that and matches any english string to their counterpart on the file.
Pretty simple and probably not the "Qt way" but it gets the job done.
I did create a class you can find in "traductor.py" to have the ".tr" method so used in Qt and I passed the poor translator around as needed

Last edited by Coleccionista; 09-20-2024 at 05:03 PM.
Coleccionista is offline   Reply With Quote
Old 09-20-2024, 06:06 PM   #14
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 28,039
Karma: 199464182
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Ah... I see. I agree that QtLinguist can be a hassle (especially for volunteer translators) but I need something I can automate. I need something that can extract the strings that need translating into a .json (which can then be edited), and could automatically update the existing jsons when the source changes.

But for something with only a handful of strings, your solution is as good as any!

Thanks.
DiapDealer is offline   Reply With Quote
Old 09-20-2024, 06:07 PM   #15
BeckyEbook
Guru
BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.BeckyEbook ought to be getting tired of karma fortunes by now.
 
BeckyEbook's Avatar
 
Posts: 782
Karma: 2298438
Join Date: Jan 2017
Location: Poland
Device: Various
I have one more suggestion, which you may or may not use.
Well, there is a ready-made package that you can use to make the plugin use dark mode without worrying about such trifles as the lack of arrows next to drop-down lists.

It works as follows:
If your system has a dark theme -> Sigil also has a dark theme -> the plugin also has a dark theme.
It simplifies life because you don't have to play around with qss styles.
But you may have had another goal in mind, such as leaving the user to switch between themes.

Look at this screenshot and tell me, does your dark mode (in Windows) look like this too? Does it have arrows next to drop-down lists?

You will probably ask how to do that.
Just use a ready-made module from here.
Attached Thumbnails
Click image for larger version

Name:	eplsemantica-dark-theme.png
Views:	31
Size:	24.5 KB
ID:	210916  
BeckyEbook is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] LOI-Generator - edit] plugin to generate a List of Illustrations KevinH Plugins 1 01-19-2023 05:31 PM
[Metadata Source Plugin] Empty Plugin? (Fake Identifier) mneimeyer Plugins 3 11-11-2019 09:07 PM
[Plugin] QuickPrefsEdit - Edit plugin prefs json files. slowsmile Plugins 3 07-25-2018 09:14 PM
Goodread Perception Expander plugin not shown on plugin list (kobo h2o) www KOReader 4 09-28-2017 11:34 AM
Problem with my ScrambleEbook plugin and the Plugin Updater tool jackie_w Development 14 01-19-2017 11:49 PM


All times are GMT -4. The time now is 05:54 PM.


MobileRead.com is a privately owned, operated and funded community.