вторник, 14 сентября 2010 г.

KDE on Mac test report

So I tried running KDE apps I miss on Mac on Mac Snow Leopard (kdevelop and kopete mainly).

I installed macports following procedures on their site, issued sudo port install kdenetwork4 (kde version is 4.4.x).
I also wrote simple Portfiles for kdevelop 1.0.2., but couldn't run a dbus session using the command given me in the terminal after each kde package install. To fix this i edited /Library/LaunchAgents/org.freedesktop.dbus-session.plist and changed OnDemand and Disabled options in it to the opposite values.



Unfortunately KDevelop crashed after i tried importing a project (you can see the backtrace on the screenshot). Other apps like KTorrent, Kopete, Lokalize are usable (although being a little ugly in the terms of appearance).

четверг, 20 мая 2010 г.

Lokalize in KDE SC 4.5

Lokalize, the KDE translation tool, saw an evolutional development during 4.4-4.5 period. Most of the changes are bug fixes. I'd like to say 'thanks' to Papp Laszlo, Hungarian translator and Chakra developer (among other things), for doing a lot of work in this regard.

As for the features, the most essential changes are:
* filestats is cached on a disk now, so the initial project scan is alot faster now.
* translation memories are improved in terms of target language: now Lokalize should be more suitable for separate projects (when .po files for all languages are in the same folder)
* simple project creation is back
* glossary storage is rewritten to use QDom classes (should eliminate any previous related crashes).

суббота, 2 января 2010 г.

Skreener 0.1 Preview Release

For the last 4 month me and several other people (see the sourcecode) had been working on a new piece of software called Skreener, to FLOSS-replace the proprietary and GTK-based Wink, tutorial and presentation creating software.

Skreener is most suited for showing how to use software, and not for showing animation effects. The main difference between Skreener and recordmydesktop (and the like) is that Skreener takes usual screenshots only once per second, and mouse cursor smooth movement is then restored during the playback. For this purpose SVG format is used (Wink generates Flash movies). This allows you to easily cleanup recorded screencast by removing non-essential frames, making the mouse cursor go strictly to the target position.

Today I decided to release the first public preview release of Skreener, just for the case if someone else decides that he is fed up with uncontributable Wink. Basic functionality is implemented, To be done is adding comments (continuing only when user clicks 'continue'), polishing.

example screencast (archived, 800 kb)
example screencast (immediate, safari-displayable, firefox-not, other browsers flicker)

On the project page, .deb package and win32 build are available.

пятница, 24 июля 2009 г.

Testing KDE 4.3 translation with Lokalize

I created Lokalize script to automate UI translation testing: it compiles currently opened PO file and puts it under ~/.kde where KDE can see it, so that when you start your application next time, it will use your translation.

To use it for your language (you'll need Lokalize coming with KDE 4.3):

cd trunk/l10n-kde4
svn up scripts
dolphin scripts/lokalize

then open Lokalize with project for your language, go to Project -> Configure project -> Scripts and drag-n-drop msgfmt.rc from dolphin to the settings area in Lokalize. Restart Lokalize. You should see a new item under Tools menu.

To make this script available automatically for all your team members copy this msgfmt.rc to l10n-kde4/LANG/lokalize-scripts (they will also need to svn up trunk/l10n-kde4/scripts).


Now a few words on packages.
I have been given write access to Debian KDE packaging repository (thanks to Sune Vuorela), where I was able to specify right dependencies and recommended packages for Lokalize. If any of other distro packagers are reading this, please sip on the spec.

P.S. I installed kde 4.2.96 packages from debian experimental (it conflicts with kdevelop package, so I reinstalled kdevelop manually with dpkg -i kdevelop_3.9.94-1_i386.deb afterwards).

вторник, 12 мая 2009 г.

Qt's DOM whitespace specifics

So I've just finished writing xliffmerge scipt that is direct analog of msgmerge@gettext and pomerge@translate-toolkit, but specially for XLIFF, i.e. it leverages all the advantages XLIFF brings, like saving information about each template update, specifying tha phase in which each unit was modified last time, and so on.

I was surprised to find out that translate-toolkit parses XML files into its own internal representation, which means they loose everything they don't support.

So to do it in a nice way, I chose to work directly with DOM representation of XLIFF file (using QDomDocument and friends). In Lokalize XliffStorage class is just a wrapper around QDomDocument.

I enabled preserving the whitespace, but in some cases it added additional whitespace, which means it modified user-editable text. The cases were clear: when no character data is between tags, it 'formats' them: inserts newline character + indent spaces. To override this behaviour I just added insertion of empty text nodes between tags. You can see the code in the end of xliffmerge.py (fixWhiteSpace*())

суббота, 9 мая 2009 г.

Scripting Lokalize

I started working on scripting support in Lokalize several months ago, but never really announced this because I wanted to write my own scripts and refine/extend API accordingly along the way.

KDE 4.3 will bring us 'officially' scriptable Lokalize. Among recent additions are new project wizard with anonsvn checkout support (screencast; it also checks out templates/ and scripts/ folders), actions to update .po from template and to compile .po into .mo and place it in local .kde folder so it could be picked up automatically by applications on the next start (see here and here for python sources).

Recently I also extended pology with ability to communicate to Lokalize, so now you can run xml checks against your translations and get erroneous files opened in Lokalize and positioned on appropriate entry.

So how it works: on each project open Lokalize scans PROJECTDIR/lokalize-scripts folder for .rc files and adds them to a 'cache' file called PROJECTDIR/lokalize-scripts/scripts.rc (so you shouldn't generally want to add it to version control system). RC files contain descriptions of scripts, particularly their paths. The path is relative to .rc file folder (or to a system scripts folder - they are tried both). So you for example can specify "../../scripts/lokalize/opensrc.py" to load script from global kde-l10n4 scripts folder (i.e. not specific to your language). Each script is represented with action in application menu (and you may assign a shortcut to it).

I wrote a script (in qtscript/javascript) to do a check specific to Russian language: %1 should be mentioned in _all_ plural forms, because, in Russian, the first form is also used for 21, 31 and so on. You can find it here. The script contains no immediate code, but only a function. The name of the function (fileSaved) is essential, because it matches the signal emitted by Editor object, which allows us to communicate with current editor tab in Lokalize. The function is automatically called on each files save, and if file contains errors, a warning is issued and wrong entries are shown. Scripts are actually don't get loaded until user explicitly triggers their action in the menu, so to override this behaviour RC file specifies <property name="autorun" >true</property>.

Below are links to API references. Everything marked as Q_SCRIPTABLE may be used from scripts
Editor object API reference
Lokalize object API reference
Project object API reference

You are welcome to write your own scripts and polish existing ones.

Lokalize screencast time

I did quite a few things during the last week.

In particular I finished implementation of storing XLIFF inline markup in translation memory and made autosubstitution mechanism more robust. Also I added support for binary units and displaying alternate translations (stored in xliff or from external file -- esp. useful for gettext po files which don't support storing alternate translations in the same file).

A screencast