Help us put Kodi strings on the wiki
#1
Lightbulb 
I haven't asked anyone on Team Kodi about this yet, so it's possible someone there can already hook me up with a solution, but I still wanted to post this where non-team members can also offer to help.


What is this?

Kodi contains "strings" where all the message text is stored. This includes warnings, settings descriptions, button labels, and more. What I would like to do is use some kind of automated/semiautomated script to pull the strings from github ( https://github.com/xbmc/xbmc/blob/master...strings.po ) and place them on a wiki page that would allow them to be usable in the same way we use them in Kodi.

This would allow for a few things, such as consistency for settings descriptions, more automated updates to the wiki making things easier to maintain, and would also help us in the future for a multi-lingual wiki. Some might know that we also use an automated python script to generate add-on pages, so that add-on authors and users can add documentation and notes about their add-ons. In fact, a great deal more can be automated, like a new setting being added to Settings/Appearances (wiki), by reading the settings.xml file. For now we'll just start out with the strings and see where that takes us.

How?

There's probably a bunch of ways to do this, but the two that stand out in my mind are either one single wiki document that is formatted in sections like this:

Code:
<section begin="string-286" />Preferred subtitle language<section end="string-286" />

or as seperate wiki template pages that are named after the string ID and only contain the string itself. Even if there are thousands of thousands of them, that shouldn't matter as only the required templates get loaded for a given wiki page, and even those get cached on the web server.

Both would need to stip/convert any formatting, such as escaping quotes like

Code:
"Press \"user\" button command"

converted to just

Code:
"Press "user" button command"


Either method (single wiki page or multiple wiki pages) would result in something that I could put to use, but my skills in creating a script to easily format them are limited. If anyone is interested in helping with this, such as any python experts, I would be in your debt.
Reply
#2
If possible, it would be great to use Pywikipediabot for this. Pywikipediabot is how we generate the add-on pages as well. Basically, it edits as if it were a logged in wiki editor and can be automatically ran at various intervals.

Information about Pywikipediabot: http://www.mediawiki.org/wiki/Pywikipediabot

Examples of the add-on scripts that we use: http://kodi.wiki/view/Kodi:Add-on_bot
Reply
#3
dirty quick hack shell oneliner:
Code:
sed -n '/msgctxt/{N;p}' strings.po | sed -e 's/msgctxt//' -e 's/msgid//' -e 's/[#"]//g' | paste - -  | while read ID TEXT; do echo "<section begin=\"string-$ID\"  />"$TEXT"<section end=\"string-$ID\" />"; done

result: http://paste.ubuntu.com/11134782/
Reply
#4
Nice! Thanks, that works perfectly :D
Reply

Logout Mark Read Team Forum Stats Members Help
Help us put Kodi strings on the wiki1