[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: extracting messages from *.js files
From:       Dominik Haumann <dhdev () gmx ! de>
Date:       2010-10-30 10:53:55
Message-ID: 201010301253.56272.dhdev () gmx ! de
[Download RAW message or body]

On Friday, 29. October 2010, Daniel Calviño Sánchez wrote:
> > in kdelibs/kate/part/script/data we have several *.js files in which we
> > support translation, with the common i18n syntax (exported functions).
> > Question is: how do we extract strings so they show up in the katepart
> > translation file?
> 
> In my own experience (with Kross,
> http://ktutorial.wordpress.com/2010/01/04/internationalization-in-kross-s
> cripts/), xgettext can extract messages from Javascript or Ruby files as
> long as the string uses C syntax, that is, the string is written with
> double quotes and wrapped in a function call using parenthesis.
> 
> So, to extract them, you don't have to do anything special, just use C
> syntax and process the Javascript files like the rest of the C/C++
> files
> (http://ktutorial.svn.sourceforge.net/viewvc/ktutorial/trunk/ktutorial/p
> o/test-app/Messages.sh?r1=65&r2=64&pathrev=65).

Ok, the addition of "-o name '*.js'" seems to do the trick already. Thanks!

> However, I don't know if you will have to do something special to use
> the translated messages. I mean, the translation module of Kross uses
> the KDE translation system, so it can get the translated messages from
> the translation file like the C++ application. I don't know how your
> i18n function behaves, although if it behaves like the Kross
> translation module one it should work out of the box :)

The i18n functions use more or less the same code as in Kross. So this will 
work.

> Also note that all this applies only when the scripts are part of the
> application. I haven't investigated yet how to extract and translate
> at runtime messages from third party scripts (for example, installed
> through GHNS).

This also works, as you can link additional translation catalogs in the 
scripts, which are then loaded by katepart :)

Greetings
Dominik
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic