How to translate addons on xbmc repo, directly from GIT source using GIT Diff

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
alanwww1 Offline
Team-XBMC Member
Posts: 1,352
Joined: Nov 2008
Reputation: 33
Location: Hungary
Star  How to translate addons on xbmc repo, directly from GIT source using GIT Diff
Post: #1
Hi All !

I already translated all currently available addons to Hungarian and i want to share the knowledge i got to know doing it.

First of all with a certain addon you can translate two texts in the addon.xml file (1. summary 2. decription) and you can add the stringd.xml language file for the addon in your language just like with xbmc.

This time for Devs the best way to send these files are not in a native format. It is better to send .patch files separated into addon categories.

You can find the available addons here:
Code:
http://mirrors.xbmc.org/addons/dharma-pre

You can track down the changes here:
Code:
http://xbmc.git.sourceforge.net/git/gitweb-index.cgi

You can see here that along with the main xbmc dir, now we can find 6 new (addon) dirs: plugins, scrapers, screensavers, scripts, skins, visualizations

This is exactly how Devs ideally expect patches from you. You need to make 6 individual patches for each of the dirs.

Currently in all 6 dirs you have to look for the "dharma-pre" branch which holds the actual addon data.

So let's get to the business.

At first install git as we need this for manipulating the git source.
Code:
sudo apt-get install git-core

Now we make a clone of the MASTER branch for the specific addon dir.
Edit: The best is if you do this directly to your .xbmc/addons dir. This way you can try out your modifications "on the fly" running xbmc and checking out the enabled addons and the strings how they show up for you. Note that you need to have a new svn version of xbmc for that. In the addon directory ALL files need to be deleted first. So backup this folder before doing this.

Code:
cd ~/.xbmc/addons
rm -rf ./*
rm -rf ./.??*
git clone git://xbmc.git.sourceforge.net/gitroot/xbmc/plugins/ ./

Note that i am doing this with the PLUGINS dir, but you will have to do it with all six of them.
(You can edit and test only ONE AT A TIME !!!)

We can check what branches are available like this:
Code:
git branch -a

We now make a working copy of the "dharma-pre" branch which currently holds the fresh data.
Code:
git checkout -b dharma-pre_working origin/dharma-pre
At this point you can start editing the addon.xml:
Important:
Please use a text editor which can set and/or convert two things:
1. Line ending character: please use linux format ending
2. character coding: please use utf8 (if the edited file is not in utf8 convert it to that firtst)

Please always avoid trailing whitespaces after the last character in the line ">" !!! Ensure that there is nothing after this character!

I suggest using notepad++. That's a windows app, but runs great in Linux with Wine.
You can convert from all format to all format.
You can even remove the accidentally left trailing whitespaces. (it's in the edit menu)

You will have to use your own country code here with summary and description (possibly title)
sections to translate the texts.

Let's create your strings.xml language file for the addon as a copy of the english one:
Code:
cp -r plugin.video.rbk.no/resources/language/English plugin.video.rbk.no/resources/language/Yourlanguage

Now we have to add this to the git system monitoring:
Code:
git add plugin.video.rbk.no/resources/language/Yourlanguage/strings.xml

Now you can translate this file with your text editor.
Note that you might need to convert the english xml file into utf-8 character coding.

After repeating these steps with all addons in this dir, you can close it with a commit note:
Please note that you HAVE TO add some note here, unless the commit won't be done.
In the commit git also adds your name and email address. You can set that with git config. You only have to do it once.
Code:
git config --global user.name "Your Name"
git config --global user.email you@example.com
git commit -a

You can even write a description of the commit.

You can always check the status of your working branch:
Code:
git status

The last step is to create the patch file:
Code:
git format-patch origin/dharma-pre --stdout > transl_plugins_yourlang.patch

Of course alway change the name of the patch.

Now you can sumbit this patch file, along with the other five files you create for each addon dir to xbmc main trac as a ticket and Devs will commit it to git.


Some usefull commands:

To clear all changes to the online branch reverting the changes on your local working branch:
Code:
git reset --hard origin/dharma-pre

To just "uncommit" the changes from the git system without phisically reset or remove the changed files:
Code:
git reset origin/dharma-pre
After this you can make git commit -a to make ALL changes you made include in ONE commit.

To "uncommit" only the last change. This bumbs down the revision of your working branch.
Code:
git reset HEAD^
Be careful because this can make the revision even lower than the online version.

And to remove ALL new files and directories that is not in git tracking:
Code:
git clean -f -d -x

If you want to update the branch:
Code:
git pull

I hope i added the informations correctly. If not just let me know and i will update this short guide.

Cheers, Alan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
(This post was last modified: 2010-07-25 18:01 by alanwww1.)
find quote