Jump to content


Photo

Language assistance requested...


  • Please log in to reply
998 replies to this topic

Re: Language assistance requested... #521 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 28 August 2018 - 03:59

Hi,

 

There will be a small delay in my posting the new NumericalTextInput.py code for testing.  The code is now complete and works perfectly in almost all cases including being called from legacy code that is unaware of the changes and new calling parameters.  My testing has revealed a small issue when NumericalTextInputcalled is called from MovieSelection that I wish to resolve.  I will keep the thread updated with my progress.

 

Regards,

Ian.



Re: Language assistance requested... #522 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 28 August 2018 - 04:06

Hi Taapat,

 

I had a look at your merged Pull Request #1702 to address the skin "title=" attributes not being translated.  It is inappropriate / incorrect to blindly translate the "title" string without checking if the value is an empty string.  The code should protect against this possibility.

 

Given that the skin is likely to be edited by people of all skill levels it is reasonable to assume that some attribute errors may occur.  It is natural to think that "" means an empty string.  Users should not need to know that this will result in a language engine status report.  It is not natural for users to know that they need to use " " to indicate an empty string.  Further, I suspect that this requirement can cause skin display issues.

 

Would you like to address this concern yourself or would you like me to update the code?

 

Regards,

Ian.


Edited by IanSav, 28 August 2018 - 04:08.


Re: Language assistance requested... #523 Taapat

  • PLi® Core member
  • 2,345 posts

+121
Excellent

Posted 28 August 2018 - 06:25

This is exactly the same blindly as parse this argument from skin for a standard title: https://github.com/O...op/skin.py#L303
There is nothing to protect.
Simply translate what's in title. If there is a "" or " ", or a phrase that is not in translation, it will simply not be translated.
If the attribute in screen does not have a title, that is not needed in all cases when using setTitle, then this is not used at all.

Edited by Taapat, 28 August 2018 - 06:28.


Re: Language assistance requested... #524 littlesat

  • PLi® Core member
  • 56,965 posts

+695
Excellent

Posted 28 August 2018 - 07:05

Why should you protect to translate an empty string? When fixed I think it should be solved at a ‘deeper’ level so everything is protected...

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Language assistance requested... #525 Huevos

  • PLi® Contributor
  • 4,598 posts

+160
Excellent

Posted 28 August 2018 - 10:03

Because empty string returns the traslator info in many images.

Re: Language assistance requested... #526 ims

  • PLi® Core member
  • 13,746 posts

+214
Excellent

Posted 28 August 2018 - 10:05

Because empty string returns the traslator info in many images.

would not be better fix this in this images ?


Kdo nic nedělá, nic nezkazí!

Re: Language assistance requested... #527 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 28 August 2018 - 10:14

Hi Taapat & Littlesat,

 

Would you please write your own test code to translate an empty string, like "", and then look at what you get returned.  It appears that neither of you have tested this case.

 

To save you time here is an example I prepared earlier:

popup = self.session.openWithCallback(self.done, MessageBox, "Translate space (\" \"):\n'%s'\n\nTranslate empty string (\"\"):\n'%s'\n\n" % (_(" "), _("")), MessageBox.TYPE_INFO)

This is what gets generated:

 

Attached File  Translate.jpg   144.85KB   2 downloads

 

Now can you see why all translated strings need to be checked and protected from empty strings?

 

Regards,

Ian.

 



Re: Language assistance requested... #528 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 28 August 2018 - 10:50

Hi Ims,
 

 

Because empty string returns the traslator info in many images.

would not be better fix this in this images ?

 
There is nothing to fix.  This is intended functionality.
 
From https://www.systutor.../man/3-gettext/ (in the "BUGS" section):

When an empty string is used for msgid, the functions may return a nonempty string.

 
From https://www.gnu.org/...al/gettext.html (10.3 The Format of GNU MO Files):

This also has another advantage, as the empty string in a PO file GNU gettext is usually translated into some system information attached to that particular MO file, and the empty string necessarily becomes the first in both the original and translated tables, making the system information very easy to find.

 
In other words, don't ask the translation system to translate empty text!  ;)  :)
 
Regards,
Ian.

 



Re: Language assistance requested... #529 ims

  • PLi® Core member
  • 13,746 posts

+214
Excellent

Posted 28 August 2018 - 10:53

PLi returns it too ... of course, I hope, nobody using _("") ...


Edited by ims, 28 August 2018 - 10:53.

Kdo nic nedělá, nic nezkazí!

Re: Language assistance requested... #530 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 28 August 2018 - 11:17

Hi Ims,

 

PLi returns it too ... of course, I hope, nobody using _("") ...

 

That is the problem, the code for the title translations is NOT checking if the text is empty!

 

I filed a pull request to fix one occurrence but I did it in haste and the patch was incorrect.  Littlesat appropriately rejected that pull request.  I have offered to correct the code again but I don't want to interfere with Taapat's efforts.  If asked I should make the corrections.  No answer yet.

 

Regards,

Ian.


Edited by IanSav, 28 August 2018 - 11:18.


Re: Language assistance requested... #531 littlesat

  • PLi® Core member
  • 56,965 posts

+695
Excellent

Posted 28 August 2018 - 12:46

In other words, don't ask the translation system to translate empty text!   ;)   :)

Agree... but I don't like sanity checks anywhere where we there could be an empty string in the request....


WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Language assistance requested... #532 Persian Prince

  • Senior Member
  • 1,982 posts

+247
Excellent

Posted 28 August 2018 - 12:58

@IanSav

 

Test image for the U4 model (for the first time) ;)

 

beyonwizu4: http://www.mediafire...u4_usb.zip/file

 

Regards,

Persian Prince


Open Vision sources: https://github.com/OpenVisionE2


Re: Language assistance requested... #533 littlesat

  • PLi® Core member
  • 56,965 posts

+695
Excellent

Posted 28 August 2018 - 13:05

The issue with the vkey pictures is not related to the skin_default stuff... The issue is that long time ago these pictures were placed on the 'root' of the skin and than suddenly in the fork of VIX it was relocated to the buttons sub directory... for PLI it is still located also in the image on the root (and therefore skin_default folder)... This can't be solved in a real structure transparent way... we only can try to remove the buttons subdir...

This 'sjit' happens when a fork of openPLi have it's own life for years.....

The only way to make it transparant is also to 'search' for the png in the root directory of the skin... and ignore the given subdirs at any time as long it is not found...


Edited by littlesat, 28 August 2018 - 13:09.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Language assistance requested... #534 Taapat

  • PLi® Core member
  • 2,345 posts

+121
Excellent

Posted 28 August 2018 - 13:09

An empty line is an exception, or error in the sources that are translated which normally happens very rarely.
It will not call the GSOD, but return the translator information.
You can easily check it and if you need remove this in your translatable text.
 
If you believe that you need check the empty text translation, then why do you want to check only this?
The text may also contain symbols causing an translation error. Why you do not check this?
 
Therefore, I am convinced that it is not necessary spend resources to check each translation only for this one event, or as written before by litelsat, it is necessary to fix it 'deeper'.

Edited by Taapat, 28 August 2018 - 13:14.


Re: Language assistance requested... #535 littlesat

  • PLi® Core member
  • 56,965 posts

+695
Excellent

Posted 28 August 2018 - 13:25

We can only make the picture stuff 'cross compatible' when we do something like this in that Resolved File stuff.... Then it does not take care anymore where the file is located...

skin = 'PLi-FullNightHD'
data = 'usr/share/enigma2'
file = 'buttons/vkey_bg.png'
 
defaultskindir = "%s/%s" % (data, 'skin_default')
skindir = "%s/%s" % (data, skin)
 
import os
base = os.path.basename(file)
for dir in [skindir, defaultskindir]:
        for f in [file, base]:
                if os.path.isfile('/%s/%s' % (dir, f)):
                         print 'picture found in /%s/%s' % (dir, f)

root@vuultimo4k:~# python test
picture found in /usr/share/enigma2/PLi-FullNightHD/buttons/vkey_bg.png
picture found in /usr/share/enigma2/skin_default/vkey_bg.png

Edited by littlesat, 28 August 2018 - 13:30.

WaveFrontier 28.2E | 23.5E | 19.2E | 16E | 13E | 10/9E | 7E | 5E | 1W | 4/5W | 15W


Re: Language assistance requested... #536 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 28 August 2018 - 13:26

Hi,

 

Where is the "_(" function defined?  Is the definition within Enigma2?  If so we could put the sanity check there and then all translations could be protected.  Just make sure that we can do a language status check if one is required.

 

Regards,

Ian.


Edited by IanSav, 28 August 2018 - 13:27.


Re: Language assistance requested... #537 Taapat

  • PLi® Core member
  • 2,345 posts

+121
Excellent

Posted 28 August 2018 - 13:38

_("") is used in About screen to check the translator: https://github.com/O...s/About.py#L142
Therefore, there is no need to change anything.


Re: Language assistance requested... #538 IanSav

  • PLi® Contributor
  • 1,491 posts

+51
Good

Posted 28 August 2018 - 13:44

Hi Taapat,

 

_("") is used in About screen to check the translator: https://github.com/O...s/About.py#L142

Therefore, there is no need to change anything.

 

What do you mean?  There is a problem if any of the XML files or any dynamic screen code ends up with a translatable text string of "".  This is definitely an issue that needs to be fixed.

 

Regards,

ian.



Re: Language assistance requested... #539 Huevos

  • PLi® Contributor
  • 4,598 posts

+160
Excellent

Posted 28 August 2018 - 15:08

Ian, to present the transalation info in the "about" screen _("") is used. That is the whole point of the empty string. If you really want an empty string somewhere "" should be used. If you make it global throughout enigma not to send the empty string for translation you break everything that correctly uses _("").

 

So really you should be sanity testing for the empty string before sending text for translating.


Edited by Huevos, 28 August 2018 - 15:10.


Re: Language assistance requested... #540 Pr2

  • PLi® Contributor
  • 6,155 posts

+261
Excellent

Posted 28 August 2018 - 15:22

Don't use _("") for empty strings if they don't have to be translated, it is the _("....") that trigger the fact that this string needs to be translated, and since it is pointless to translate empty string it doesn't make sense to use the "to be translated" syntax. So no sanity check needed, just good programming habits.

 

If you want to understand how translation work you need to have a view at gettext because it is what is used to get the translatable screen. This is a standard tools so not specific to enigma2.

 

https://github.com/O...ateallpo.sh#L30


NO SUPPORT by PM, it is a forum make your question public so everybody can benefit from the question/answer.
If you think that my answer helps you, you can press the up arrow in bottom right of the answer.

Wanna help with OpenPLi Translation? Please read our Wiki Information for translators

Sat: Hotbird 13.0E, Astra 19.2E, Eutelsat5A 5.0W
VU+ Solo 4K: 2*DVB-S2 + 2*DVB-C/T/T2 (used in DVB-C) & Duo 4K: 2*DVB-S2X + DVB-C (FBC)

AB-Com: PULSe 4K 1*DVB-S2X (+ DVB-C/T/T2)
Edision OS Mio 4K: 1*DVB-S2X + 1*DVB-C/T/T2
 



51 user(s) are reading this topic

0 members, 50 guests, 0 anonymous users


    Bing (1)