Kodi Community Forum

Full Version: IPTV Recorder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've found a nice bit of code from @metate which looks promising.
https://forum.kodi.tv/showthread.php?tid=268081
Do you want to have a go with the languages?
Just put a _("english string") around the strings you want to translate like this:
https://github.com/primaeval/plugin.vide...d1935dR172
Then follow the instructions to install grep on Windows and run
python language.py
in the addon folder.

It would be easier on linux.
I will give it a try, will do a PR when I'm done

Something might be required to install the module on the final device, no ?
When the language.py file is run as part of the addon in Kodi it doesn't need the po module.
It just runs the "else" section at the bottom which uses a dict to substitute the strings.
https://github.com/primaeval/plugin.vide...bd8b06cR43
I made a PR for the translation stuff, I created a French translation file, but it doesn't use it, do you have an idea why ?

For the channel group scrolling, it's working the first time, but when you come back to the same page, there is a scroll again
The scroll should only occur if we are on the first entry
Thanks. I should have guessed from your github name you were French. I was speaking to someone from Germany earlier.

I don't know why it won't pull in the French strings. I've never had to switch the language on Kodi before.

I've just spent an hour wondering why the scrolling jumps around.
They've missed telling us about the "absolute" parameter you can add to SetFocus to go the correct position.
I still get the scroll when I come back to the page

We probably need to check the current selection (maybe like https://forum.kodi.tv/showthread.php?tid=135205 ?)

I fixed the translation issue, I just made a mess with "msgid" and "msgstr" tags, "msgstr" what empty so it fallback to english
I'm not if there is an easy way to do the Settings translations. Have you had a look?

I fixed the scroll with a list selectItem call.
http://mirrors.xbmc.org/docs/python-docs...selectItem
The days of the week in the channel listing aren't getting translated either.
I'm not sure how to do date translations.
There is no need of a translation setting, it's handled by Kodi, the local language will be loaded if available (eg: French), else fallback to English

About the days, we can either translate them manually (not that good, we might have the same problem with months), or if there is any way we can get the local code (en, en_UK, ...), we can use the builtin functions (like locale.setLocal())
I meant the xml Settings.
https://github.com/primaeval/plugin.vide...ttings.xml

There is a call to get some basic regional info from Kodi but that needs to be used to get regional datetime strings somehow.
http://mirrors.kodi.tv/docs/python-docs/...-getRegion
For the settings XML file, looks like we need to use the string ID

For the language, it's possible to retrieve the 2 letter code from "getLanguage" function
http://mirrors.kodi.tv/docs/python-docs/...etLanguage
This returns something like "en", "fr", or with region option "en-UK", "fr-FR"

Maybe something like that ?

python:
loc = xbmc.getLanguage(xbmc.ISO_639_1, true).replace("-", "_") + ".utf8"
locale.setlocale(locale.LC_TIME, loc)
print(datetime.datetime.today().strftime("%A"))
Good idea. It needs something else though. I put it at the top of main, changed true to True and it said.
Error: unsupported locale setting

loc is 'fr_be.utf8'
I don't know whether to automatically trigger a listing refresh or leave it up to the user.

You can do a refresh with a keymap.xml setting like this:
xml:
 <keymap>
  <global>
    <keyboard>
      <r>Container.Refresh</r>
    </keyboard>
  </global>
</keymap>
Looks like it's based on system packages, I have the same error on my testing env

I need to check others addon to see how they are doing it