Kodi Community Forum
Solved Can't get strings.po too work - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Solved Can't get strings.po too work (/showthread.php?tid=357782)



Can't get strings.po too work - Space2Walker - 2020-10-17

Hi I am the maintainer of the DNS Leak-Test addon in the official repo,
as the title says i can't figure out why my strings.po aren't working (I'm on this for days now)

code:
Github repo

i don't get any error message but my strings are blank,
the logs say nothing unusual.
except i don't see my language loaded like this:
"LocalizeStrings: loaded 3 strings from file /home/lord/.kodi/addons/script.module.web-pdb/resources/language/resource.language.en_gb/strings.po"

I'm pretty much out of ideas, so PLEASE help me.

P.S
 sorry for the bad English i am not a native speaker


RE: Can't get strings.po too work (please help) - jbinkley60 - 2020-10-17

(2020-10-17, 21:21)Space2Walker Wrote: Hi I am the maintainer of the DNS Leak-Test addon in the official repo,
as the title says i can't figure out why my strings.po aren't working (I'm on this for days now)

code:
Github repo

i don't get any error message but my strings are blank,
the logs say nothing unusual.
except i don't see my language loaded like this:
"LocalizeStrings: loaded 3 strings from file /home/lord/.kodi/addons/script.module.web-pdb/resources/language/resource.language.en_gb/strings.po"

I'm pretty much out of ideas, so PLEASE help me.

P.S
 sorry for the bad English i am not a native speaker

Instead of:

set_label(get_local(62001))

try:

set_label(addon.getLocalizedString(62001))

And see if that works for you.  This link might help.


Jeff


RE: Can't get strings.po too work (please help) - Space2Walker - 2020-10-18

python:
addon = xbmcaddon.Addon()
set_label(addon.getLocalizedString(62001))

doesn't work same behavior as before

i have uploaded a full debug log at https://pastebin.com/Fuvg3mu3 maybe it will be helpful too figure this out


RE: Can't get strings.po too work (please help) - Space2Walker - 2020-10-18

(2020-10-17, 23:43)jbinkley60 Wrote: And see if that works for you.  This link might help.

i have read the docs but i don't get what the problem is,
i call the function as indented, getting no errors but still it doesn't work


RE: Can't get strings.po too work (please help) - jbinkley60 - 2020-10-18

I downloaded and installed the addon.  I added the following lines of code to force getting the string and writing to the Kodi logfile:

addon = xbmcaddon.Addon()
locstr = addon.getLocalizedString(62002)
xbmc.log('String 62002 is: ' + str(locstr), xbmc.LOGINFO)

The result was:

2020-10-18 07:27:51.371 T:15032    INFO <general>: String 62002 is:

This confirms it isn't getting the string from the strings.po file but the debug file doesn't show anything.  I compared your code against an addon I maintain and even replaced your language folder with mine and it still didn't work.  I don't see anything obvious which is causing this.  Maybe one of the Kodi team members or someone more experienced than me in this space can look at it.  Sorry I can't help more.  I am curious too now what the issue is.


Jeff


RE: Can't get strings.po too work (please help) - Space2Walker - 2020-10-18

(2020-10-18, 13:35)jbinkley60 Wrote: I downloaded and installed the addon.  I added the following lines of code to force getting the string and writing to the Kodi logfile:

addon = xbmcaddon.Addon()
locstr = addon.getLocalizedString(62002)
xbmc.log('String 62002 is: ' + str(locstr), xbmc.LOGINFO)

The result was:

2020-10-18 07:27:51.371 T:15032    INFO <general>: String 62002 is:

This confirms it isn't getting the string from the strings.po file but the debug file doesn't show anything.  I compared your code against an addon I maintain and even replaced your language folder with mine and it still didn't work.  I don't see anything obvious which is causing this.  Maybe one of the Kodi team members or someone more experienced than me in this space can look at it.  Sorry I can't help more.  I am curious too now what the issue is.


Jeff

Thanks Jeff for trying and time spend

I'm thinking about filing a bug report for it now as the bug is not in my code or in strigs.po from what it looks like,
but i will wait at least a few days.
The only thing i came up with in the meantime was too try do make "resources" a py package(__init__.py) but didn't work.

So hopefully someone can find the bug.


RE: Can't get strings.po too work - ronie - 2020-10-18

looks like there's a space in front of the 'language' foldername.
plugin.program.dnsleaktest/resources/ language/


RE: Can't get strings.po too work - Space2Walker - 2020-10-18

(2020-10-18, 15:32)ronie Wrote: looks like there's a space in front of the 'language' foldername.
plugin.program.dnsleaktest/resources/ language/

Thank you so much ronie, it works !!

Such a dumb mistake now i feel stupid.
Is there a way do mark this as solved?


RE: Can't get strings.po too work - jbinkley60 - 2020-10-18

I'll be darned.  I missed the space too.  Ironically when I was testing I didn't replace the language folder itself just the contents of it.  Had I replaced the entire folder I would have likely caught it. At least it was an easy fix.


Jeff


Can't get strings.po too work - ronie - 2020-10-18

Thread marked solved.


RE: Can't get strings.po too work - Space2Walker - 2020-10-18

I thought about the problem again during lunch and think
python:
getLocalizedString()
should produce an error message if no data is found in the path.

Possibly only the first time it is loaded in order to save computing time.
This would help future developers to recognize the problem.

what to you think about this @jbinkley60 ?

I don't want to make an issue for this, is there a "future request" thread for that kind of thing?


RE: Can't get strings.po too work - jbinkley60 - 2020-10-18

(2020-10-18, 16:43)Space2Walker Wrote: I thought about the problem again during lunch and think
python:
getLocalizedString()
should produce an error message if no data is found in the path.

Possibly only the first time it is loaded in order to save computing time.
This would help future developers to recognize the problem.

what to you think about this @jbinkley60 ?

I don't want to make an issue for this, is there a "future request" thread for that kind of thing?

I like the idea as a debugging option but I am thinking what would it tell us ?  We already knew it couldn't find the data.  We just didn't know why.  I kept thinking that as I was looking at it, that for some reason it couldn't find the strings.po file.  I just thought there may be a reference pointer somewhere which needed to be set vs. a simple path problem issue.  Maybe a debugging message saying /language path not found or no strings.po file found ?  The last one would tell us the difference between a problem with the file vs. not being able to find the file.


Jeff


RE: Can't get strings.po too work - Space2Walker - 2020-10-18

(2020-10-18, 18:36)jbinkley60 Wrote: I like the idea as a debugging option but I am thinking what would it tell us ?  We already knew it couldn't find the data.  We just didn't know why.  I kept thinking that as I was looking at it, that for some reason it couldn't find the strings.po file.  I just thought there may be a reference pointer somewhere which needed to be set vs. a simple path problem issue.  Maybe a debugging message saying /language path not found or no strings.po file found ?  The last one would tell us the difference between a problem with the file vs. not being able to find the file.


Jeff

I think the "strings.po not found at <path>" error will work.

During my update of the addon i discovered a related issue in the "kodi-addon-cheker".

It reports:
"INFO: PO files are valid"

even if the path is broken, so i think the checker should also raise an error.
now that i found the future request thread maybe i write a request, and write an issue in addonchecker, so nobody will hang on that error again.

Thanks again for the feedback Jeff


RE: Can't get strings.po too work - Space2Walker - 2020-10-20

(2020-10-18, 19:36)Space2Walker Wrote: During my update of the addon i discovered a related issue in the "kodi-addon-cheker".

It reports:
"INFO: PO files are valid"

even if the path is broken, so i think the checker should also raise an error.
For Future reference, addon-checker has a open PR for this issue now.
addon-checker PR