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

List:       koffice-devel
Subject:    Re: I18n in koffice scripts
From:       Dag Andersen <danders () get2net ! dk>
Date:       2008-12-15 14:28:35
Message-ID: 200812151528.35318.danders () get2net ! dk
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Ok, I've been around the block a few times more, so I'll try to sum up my 
findings.
First the premisses for this:
I want to have some scripts translated :)
These scripts are always run from within a koffice application (eg kplato) and 
can be regarded as an extension/part of that applications functionallity. This 
means that the user expects the language (and locale in general) to be the 
same as the rest of the application.

Based on this, I rule out use of lange specific gettext (locale problems) and 
qt tr() (locale/extraction probelms), and wote for implementing i18n* methods 
someplace the scripts can get at it.
I've been looking at kdelibs kross, but imho the best place would be in the 
core modules, and since this is planned to be qt only, that's not possible.
The next best thing is really in KoKross::KoScriptingModule. I see that 
somebody else has had the same idea as there is already a translate() method 
for this. I propose to implement "full" i18n* methods that will wrap ki18n* 
calls the way I've posted earlier.

If nobody screams to loud I'll implement this, I have most of it tested 
including message extraction et al.

On Torsdag 04 december 2008 10:28:40 Dag Andersen wrote:
> Hi,
> On kde-i18n-doc@kde.org we have been discussing internationalization of
> strings originating in scripts. Eg I have a python script with:
> self.dialog = self.forms.createDialog("Busy Information Import")
> where the string pops up in a dialog and should be translated.
> We have been around the standard python way _() and the python bindings in
> kdebindings, but as Burkard points out it would be best to avoid dependency
> on kdebindings.
> Looking at the code, afaics there are two possibilities:
> 1) Translation via Kross. It seems it provides interface to the qt tr()
> function. It also seems that there is a desire to *not* depend on kdelibs,
> so i18n* is ruled out, or?
> 2) Providing access to i18n via KoKross in koffice libs. I tested adding a
> translate() method in KoScriptingModule, and was then able to get strings
> translated by calling KPlato.translate( "text") in my script if "text"
> existed in krossmodulekplato.mo.
>
> Imvvho 2) seems to be the way to go. Opinions? Is there simpler/better way?
>
> Anyhow, we need a eay to mark strings for translation that enables us to
> extract them with extractrc or extractattr.

-- 
Mvh.
Dag Andersen

[Attachment #5 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" \
"http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" \
content="1" /><style type="text/css">p, li { white-space: pre-wrap; \
}</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; \
font-weight:400; font-style:normal;">Ok, I've been around the block a few times more, \
so I'll try to sum up my findings.<br> First the premisses for this:<br>
I want to have some scripts translated :)<br>
These scripts are always run from within a koffice application (eg kplato) and can be \
regarded as an extension/part of that applications functionallity. This means that \
the user expects the language (and locale in general) to be the same as the rest of \
the application.<br> <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;"><br></p>Based on this, I rule out use of lange \
specific gettext (locale problems) and qt tr() (locale/extraction probelms), and wote \
for implementing i18n* methods someplace the scripts can get at it.<br> I've been \
looking at kdelibs kross, but imho the best place would be in the core modules, and \
since this is planned to be qt only, that's not possible.<br> The next best thing is \
really in KoKross::KoScriptingModule. I see that somebody else has had the same idea \
as there is already a translate() method for this. I propose to implement "full" \
i18n* methods that will wrap ki18n* calls the way I've posted earlier.<br> <p \
style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; \
margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>If \
nobody screams to loud I'll implement this, I have most of it tested including \
message extraction et al.<br> <p style="-qt-paragraph-type:empty; margin-top:0px; \
margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; \
text-indent:0px; -qt-user-state:0;"><br></p>On Torsdag 04 december 2008 10:28:40 Dag \
Andersen wrote:<br> &gt; Hi,<br>
&gt; On kde-i18n-doc@kde.org we have been discussing internationalization of<br>
&gt; strings originating in scripts. Eg I have a python script with:<br>
&gt; self.dialog = self.forms.createDialog("Busy Information Import")<br>
&gt; where the string pops up in a dialog and should be translated.<br>
&gt; We have been around the standard python way _() and the python bindings in<br>
&gt; kdebindings, but as Burkard points out it would be best to avoid dependency<br>
&gt; on kdebindings.<br>
&gt; Looking at the code, afaics there are two possibilities:<br>
&gt; 1) Translation via Kross. It seems it provides interface to the qt tr()<br>
&gt; function. It also seems that there is a desire to *not* depend on kdelibs,<br>
&gt; so i18n* is ruled out, or?<br>
&gt; 2) Providing access to i18n via KoKross in koffice libs. I tested adding a<br>
&gt; translate() method in KoScriptingModule, and was then able to get strings<br>
&gt; translated by calling KPlato.translate( "text") in my script if "text"<br>
&gt; existed in krossmodulekplato.mo.<br>
&gt;<br>
&gt; Imvvho 2) seems to be the way to go. Opinions? Is there simpler/better way?<br>
&gt;<br>
&gt; Anyhow, we need a eay to mark strings for translation that enables us to<br>
&gt; extract them with extractrc or extractattr.<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; \
margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; \
-qt-user-state:0;"><br></p>-- <br> Mvh.<br>
Dag Andersen</p></body></html>



_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


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

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