Alpha script.LibreTranslate
#16
@kcook_shield

I noticed that for sentences where the "," or the "." the translation stops, and does not take the next text.

Example:

xml:
<onload>RunScript(script.LibreTranslate,q=$INFO[ListItem.Property(Next_Aired.Long)],property=c)</onload>

<label>Prossimo Episodio: $INFO[Window(Home).Property(libreTranslate_c)]</label>

instead of returning: "Domenica, 20. Novembre 2022"
Returns: "Domenica"

I think it stops when you find "," or "." interrupting the translation.
(I have set the translation in "Italian" if you want to repeat the test, I think it behaves in this way with all other languages.)

I also tried with $ESCINFO, but in this case it never returns anything, it just returns  "  "#"  " and I don't understand where it gets this symbol from.


Is it possible to translate the entire sentence, including punctuation marks?


Thanks for your great support 🙏
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#17
@"alberto1998" 

Try:

RunScript(script.LibreTranslate,q='$ESCINFO[ListItem.Property(Next_Aired.Long)]',property=c)

And you likely want to do the same for any data passed using q='$ESCINFO[............]'

And it looks like I need to make a change in the cache logic, as it needs to also take into consideration the "translate to" language, otherwise changing "translate to" language may give the old cached results for another language.

I will fix this soon, and also add ability to clear the cache (in case you need/want to do that after some testing).
Reply
#18
@"alberto1998" 

I have made one change, to include the "translate to" language as part of the cache identifier.

After update to version 0.0.9 , it will use this.

No need to clear cache to see this apply now.
Reply
#19
@kcook_shield

ok, now it works perfectly.

In the output string I changed $ESCINFO in $INFO and it works, returning fewer quotes (")

so:
xml:
<onload>RunScript(script.LibreTranslate,q='$ESCINFO[ListItem.Property(Next_Aired.Long)]',property=c)</onload>
<label>Prossimo Episodio: $INFO[Window(Home).Property(libreTranslate_c)]</label>


But despite this, the quotation marks are still displayed.: "  ...  "

Each time it returns the translation in a different way, example:
Domenica, 20 Novembre 2022   (rarely)
"Domenica, 20. Novembre 2022"   (very often)
' "Domenica, 20. Novembre 2022" '   (sometimes)

It almost always shows the quotes, so I think sometimes the translation engine lets these characters ( " ' ) pass while other times it doesn't.
Is there any way to clean up the output string by removing the quotes?
(example: replace them with empty characters, spaces, or other)
or make sure that they are not displayed?



Thank you for your support 🙏
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#20
@"alberto1998" 

I have modified to clean up extraneous quotation marks.

Version 0.0.10 should give you the expected results now.
Reply
#21
@kcook_shield

Excellent, now its functioning is perfect.

The only thing missing is an option to enable and disable caching (via a radiobutton or some other way to keep it active) (it's important and for testing purposes only)
and the days on which you want to keep the cache active (10, 15, 30, ... ).

In this way it can be considered a complete and functional addon.



Thanks for developing it and helping me and the community. ❤🙏
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#22
@"alberto1998" 

I have added a setting "Days to cache" , default is 30 days, can be set to zero ( 0 ) to disable the cache.
Reply
#23
@kcook_shield

Thanks, now it's a complete addon 👍
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#24
@kcook_shield

I have seen that when browsing in multiple windows the old content of the $INFO[Window(Home).Property(libreTranslate_a)] is always reloaded, and then subsequently updated with the new content.
Is there a way to "reset" the $INFO[Window(Home).Property(libreTranslate_a)] and then each time it is filled without the old content already being there?

Example:

xml:
<onunload>SetProperty(libreTranslate_a,EMPTY)</onunload>

but it doesn't work... (just to understand what I mean)


What can I add to my XML code to clear the contents of $INFO[Window(Home).Property(libreTranslate_a)] when closing the window?


Thank you very much and forgive me if i couldn't figure it out by myself 🙏
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#25
@"alberto1998" 

Perhaps:

ClearProperty(libreTranslate_a,10000)

Though your method may also work if you specify the home window id 10000 :

SetProperty(libreTranslate_a,EMPTY,10000)
Reply
#26
@kcook_shield

I couldn't get it to work that way, instead using ClearProperty(libreTranslate_a,10000) it works.

I didn't think I had to specify the ID of the same window, as the ClearProperty code was supposed to work right in the same window I entered it in, but I still added and used the ID and it worked.


Thanks for your help.
Now it works as it should.
If i helped you, you can thank me with a thumbs up 👍 below, thanks 🙏.
Kodi 20.x stable release | Skin Confluence (by Jezz_X)
I like editing skins ❤
Reply
#27
Thank you for your addon.
I'd like to use it in my container like this. Please let me know what is wrong (it does not work, maybe I gave wrong syntax or something)
xml:

 <control type="list" id="903">
     <itemlayout height="240" width="180">
        ...
     </itemlayout>
     <focusedlayout height="240" width="180">
        ...
        <!-- placed hidden button -->
        <control type="button">
            <visible allowhiddenfocus="true">false</visible>
            <onfocus>RunScript(script.LibreTranslate,q='$ESCINFO[ListItem.Director]'),property=a)</onfocus>
        </control>
    </focusedlayout>
<control type="group">
        <control type="label">
                  <label>$INFO[Container(903).Property(libreTranslate_a)]</label2>
         </control>
</control>
...
               
Reply
#28
I'm about out for today. At first glance it seems ok.

But a search of forum pulled up something that might shed light on this usage:

https://forum.kodi.tv/showthread.php?tid=350568

I'll check back tomorrow, and if needed, will run some testing to figure it out (though I'm not great at skinning, I do understand xml and some of what goes on in these skin files).
Reply
#29
Yes, please.
For more detail...
I get movie information(Direcor, Writer...etc) using script.embuary.helper. It shows English on the skin. I like to change it to Korean.

xml:

 <label fallback="N/A">$INFO[ListItem.Director]</label>
 <label fallback="N/A">$INFO[ListItem.Writer]</label>

to test, I take $INFO[ListItem.Director] using a container like this
xml:

<control type="list" id="903">
 <itemlayout> </itemlayout>
    <focusedlayout>

 <!-- placed hidden button -->
        <control type="button">
            <visible allowhiddenfocus="true">false</visible>
            <onfocus>RunScript(script.LibreTranslate,q='$ESCINFO[ListItem.Director]'),property=a)</onfocus>
        </control>
    </focusedlayout>
    <content>$VAR[EmbuaryCast]</content>
</control>
EmbuaryCast is defined
xml:

<variable name="EmbuaryCast">
    <value condition="String.IsEqual(ListItem.DBType,movie) + !String.IsEmpty(ListItem.DBID) + !String.IsEqual(ListItem.DBID,0)">plugin://script.embuary.helper?info=getcast&type=movie&dbid=$INFO[ListItem.DBID]</value>
</variable>
Reply
#30
I will try replicating the issue using Korean translation setting. I wonder if maybe the encoding of such a language is not accounted for in my script. I will try and get back to you tomorrow with results of test.
Reply

Logout Mark Read Team Forum Stats Members Help
script.LibreTranslate0