Bug 181145 - Lokalize cannot create the mo files
Summary: Lokalize cannot create the mo files
Status: RESOLVED FIXED
Alias: None
Product: lokalize
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Mandriva RPMs Linux
: NOR wishlist
Target Milestone: ---
Assignee: Nick Shaforostoff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-18 09:18 UTC by Dimitrios Glentadakis
Modified: 2017-05-18 17:20 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Export to mo script with kdialog (2.57 KB, text/x-python)
2014-01-25 08:29 UTC, Dimitrios Glentadakis
Details
with 'ts' export to 'qm' support (3.44 KB, text/x-python)
2014-01-25 21:04 UTC, Dimitrios Glentadakis
Details
Lokalize script to compile and export po and ts files (4.66 KB, text/x-python)
2017-05-18 03:43 UTC, Dimitrios Glentadakis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitrios Glentadakis 2009-01-18 09:18:04 UTC
Version:            (using KDE 4.1.3)
OS:                Linux
Installed from:    Mandriva RPMs

In the programm poedit , when on quit ( or save ) it creates the .mo file 
Is this possible with Lokalize ?
Comment 1 Nick Shaforostoff 2009-01-18 22:01:37 UTC
it can be implemented using kross script. i'll do it for KDE 4.3
Comment 2 Dimitrios Glentadakis 2009-01-19 13:17:06 UTC
(In reply to comment #1)
> it can be implemented using kross script. i'll do it for KDE 4.3
> 

Thank you very much !

Dimitris
Comment 3 Nick Shaforostoff 2009-05-08 01:42:13 UTC
I implemented msgfmt script specific to KDE, and placed it in 
http://websvn.kde.org/trunk/l10n-kde4/scripts/lokalize/
(see README).

creating of .mo files for other projects may be done by modifying that script.

I'll also add some hints to the documentation.
Comment 4 Daniele Scasciafratte 2013-06-04 16:39:58 UTC
but integrate this feature on the menu of lokalize?
Comment 5 Dimitrios Glentadakis 2013-06-05 04:51:22 UTC
Yes would be nice to have it in the menu
Now i see it but it is grey.
I downloaded the script in ~/.kde4/share/apps/lokalize/scripts
and the rc file in ~/.kde4/share/apps/lokalize/
but it is still grey.

I read the help and it says that we have to put the script in the folder "PROJECTDIR/lokalize-scripts" but i dont know what is the PROJECTDIR.

I think that is not easy to use it in that way as a script because eg: for me it is still impossible to use it as i did nt find the way how to use this.
Comment 6 Nick Shaforostoff 2013-06-05 09:38:36 UTC
Go to Project -> Configure project. Look up a directory of your current project.
Open it in Dolphin, create lokalize-scripts folder in it, then put both .rc and .py files in it. restart lokalize
Comment 7 Daniele Scasciafratte 2013-06-05 13:49:28 UTC
it's not user friendly this things.
i think that like in poedit when save the file generate the mo, simple and more useful.
Comment 8 Dimitrios Glentadakis 2013-06-07 04:26:11 UTC
Unfortunately i could nt make it work
I placed the script in the place where the project is in a folder 'lokalize-scripts' but the menu is always grey, even after restarted lokalize

The problem is that i have different projects, i need to place the scripts in each folder?
I thought that a script would be in a place like in the /usr/share/lokalize for all projects and/or if there is no any project created. It is not possible to use it with unique po files ?

I have to agree with Mte90 that this is not a user friendly way for this.
Why not include it in lokalize definitely.
Comment 9 Nick Shaforostoff 2013-06-07 06:29:22 UTC
I will include it for 4.11.

can you post a konsole output of the lokalize? Maybe you don't have krosspython installed.
also, what distribution are you using?

in http://packages.debian.org/experimental/lokalize i see that krosspython is not a hard dependency, but a recommended one.
Comment 10 Dimitrios Glentadakis 2013-06-07 14:25:17 UTC
I have Mageia. The package is the kross-interpreters-python which it was nt installed.
I installed it but i dont find where is the mo file. 

in terminal i have this:

Kross: "PythonScript::execute" 
Kross: "PythonScript::execute result=None" 

Maybe i dont have any output ?
Comment 11 Nick Shaforostoff 2013-06-07 16:58:38 UTC
did you look at ~/.kde/share/locale/<YOUR_LANG>/LC_MESSAGES ?
or ~/.kde4/share/locale/<YOUR_LANG>/LC_MESSAGES
Comment 12 Dimitrios Glentadakis 2013-06-08 06:56:45 UTC
(In reply to comment #11)
> did you look at ~/.kde/share/locale/<YOUR_LANG>/LC_MESSAGES ?
> or ~/.kde4/share/locale/<YOUR_LANG>/LC_MESSAGES

Yes it is there. :)

Thanks
Comment 13 Daniele Scasciafratte 2014-01-07 14:15:03 UTC
any news for this feature?
Comment 14 Dimitrios Glentadakis 2014-01-25 08:29:52 UTC
Created attachment 84834 [details]
Export to mo script with kdialog

I added a kdialog menu to the script so you can choose to export the mo file to the default or a custom path
Please test it i am not developer.
Comment 15 Dimitrios Glentadakis 2014-01-25 21:04:02 UTC
Created attachment 84843 [details]
with 'ts' export to 'qm' support
Comment 16 Daniele Scasciafratte 2015-06-15 11:01:17 UTC
Doesn't work to me, i get only:
```
lokalize(11765)/lokalize (TM) TM::ScanJob::run: ScanJob: done  96 
lokalize(11765)/lokalize (TM) TM::ScanJob::~ScanJob: KUrl("file://pathchangedbyme/file.po") 
Kross: "PythonScript::execute" 
Kross: "PythonScript::execute result=None" 
```
Comment 17 Dimitrios Glentadakis 2015-06-16 03:46:50 UTC
I think that the files are created in the local folder see comment 11

If you want to control the output, download the two files 
msgfmt-po+ts.py
msgfmt-po+ts.rc
from here:
http://websvn.kde.org/trunk/l10n-kde4/el/lokalize-scripts/

and copy them to:
~/.kde4/share/apps/lokalize/scripts
or 
~/.kde/share/apps/lokalize/scripts
depending your system

then you will have this dialogue when you want to export:
http://img13.imageshack.us/img13/2175/hco2.png
Comment 18 Daniele Scasciafratte 2015-06-16 12:56:06 UTC
This script works but not alert from error like that (is in italian):
languages/promote-mdn-it_IT.po:180: definizione del messaggio duplicata...
languages/promote-mdn-it_IT.po:145: ...questa รจ la posizione della prima definizione
msgfmt: trovato 1 errore fatale
Kross: "PythonScript::execute result=None" 

Also will be useful to support to default the same folder of the po file as output path.
I give a look to the script :-) thanks for the help!
Comment 19 Daniele Scasciafratte 2015-06-16 13:22:11 UTC
Okay new version of this script with:
- Alert for wrong extension 
- Same path of the po/ts file option
- Better check for existing file 

https://paste.kde.org/peummsmtk
Comment 20 Dimitrios Glentadakis 2015-06-17 03:23:53 UTC
(In reply to Daniele Scasciafratte from comment #19)
> Okay new version of this script with:
> - Alert for wrong extension 
> - Same path of the po/ts file option
> - Better check for existing file 
> 
> https://paste.kde.org/peummsmtk

Great !

@Nick: what about include this script in lokalize installation ?
Comment 21 Daniele Scasciafratte 2017-05-16 19:05:41 UTC
This missing feature is blocking me to switch from PoEdit to Lokalize... (there is also the scanning for the pot but I can survive without it on lokalize).
Also the script is not anymroe available...
Comment 22 Dimitrios Glentadakis 2017-05-17 02:36:18 UTC
(In reply to Daniele Scasciafratte from comment #21)
> Also the script is not anymroe available...

What do you mean 'the script is no more available' ?
Comment 23 Daniele Scasciafratte 2017-05-17 09:22:40 UTC
That the same script shared by me on https://paste.kde.org/peummsmtk years ago is not available anymore. And I forgot it to done it a patched version...
Comment 24 Dimitrios Glentadakis 2017-05-18 03:43:47 UTC
Created attachment 105611 [details]
Lokalize script to compile and export po and ts files
Comment 25 Dimitrios Glentadakis 2017-05-18 03:44:42 UTC
(In reply to Daniele Scasciafratte from comment #23)
> That the same script shared by me on https://paste.kde.org/peummsmtk years
> ago is not available anymore. And I forgot it to done it a patched version...

Ok i uploaded the version with your update
Comment 26 Daniele Scasciafratte 2017-05-18 09:26:55 UTC
Thank you so much!
I modified based on my new needs and I shared on https://github.com/Mte90/Script/tree/master/lokalize
Actually is not running on save of the po file but is better now than before without this script.
Also I saw on debian that the folder inside my home folder is not reconize but only the root one on Debian.
Comment 27 Dimitrios Glentadakis 2017-05-18 15:39:11 UTC
Ok great, is better in github,
You mean that you removed the ts support because it doesn't work ?
For me it works the po and ts version without any problem.
Comment 28 Daniele Scasciafratte 2017-05-18 17:20:46 UTC
the script is working very good only that today I need only the po support. 
I want also that will be execute on save of the po file (the .rc file) but actually this not happen.