Interface translation (.po files generation)

21 views
Skip to first unread message

Paolo

unread,
Feb 11, 2012, 11:24:51 AM2/11/12
to Merengue Developers
I have sucessfully added a new language (Portuguese) using the ./
manage.py sync_transmeta_db command, how can I then generate the .po
files for translating the rest?

Thanks!

Jesaja Everling

unread,
Feb 11, 2012, 3:38:38 PM2/11/12
to merengue-...@googlegroups.com
Hi Paolo,

I'm currently in the process of translating Merengue to German, so I
had the same problem.
I managed to create the .po files for the plugins, but didn't find a
good way to create the .po files for the "merengue" folder.

The plugins:
To create the .po files for the plugins, there is a management
command, makepluginsmessages.
It doesn't accept the --locale parameter, so the folders for the
translation have to exist beforehand.
I think you should be able to add the folders for the plugins like this:

(run in "plugins" folder)
find ./* -name "locale" -exec mkdir -v {}/pt \;

Then you can just execute "python manage.py makepluginsmessages" from
your project directory, and the .po files should be created in the
"pt" subdirectories of each plugin's locale directory.


I didn't find a way to create all the .po files for the "merengue"
folder. I created a .po file for "merengue/locale/" by running
manage.py from inside the "merengue" folder.
For this, I had to give the complete path to manage.py (../manage.py
didn't work), and had to copy my sql-database file into the merengue
folder.
While this works for "merengue/locale", it doesn't work for
"merengue/block/locale" for example.

There surely has to be a better way, maybe it would be easier to just
copy the "en" folder for each "locale" directory, and rename it to
"pt".

If you find a good way to create the translations for the
merengue-folder, let me know!

Jorge Correa Herrero

unread,
Feb 13, 2012, 3:54:52 AM2/13/12
to merengue-...@googlegroups.com


2012/2/11 Jesaja Everling <jeve...@gmail.com>

Hi Paolo,

I'm currently in the process of translating Merengue to German, so I
had the same problem.
I managed to create the .po files for the plugins, but didn't find a
good way to create the .po files for the "merengue" folder.

The plugins:
To create the .po files for the plugins, there is a management
command, makepluginsmessages.
It doesn't accept the --locale parameter, so the folders for the
translation have to exist beforehand.
I think you should be able to add the folders for the plugins like this:

(run in "plugins" folder)
find ./* -name "locale" -exec mkdir -v {}/pt \;

I´ve just checked the code in makepluginsmessages and the only one needing a folder is "locale". If you have this folder inside your plugin, the subdirectory for all the languages belongins to settings.LANGUAGES in your settings.py will be created automatically together with their corresponding .po file.
When you finish the translations for all the messages in your .po file. you need to execute ./manage.py compilepluginsmessages
 

Then you can just execute "python manage.py makepluginsmessages" from
your project directory, and the .po files should be created in the
"pt" subdirectories of each plugin's locale directory.


I didn't find a way to create all the .po files for the "merengue"
folder. I created a .po file for "merengue/locale/" by running
manage.py from inside the "merengue" folder.
For this, I had to give the complete path to manage.py (../manage.py
didn't work), and had to copy my sql-database file into the merengue
folder.
While this works for "merengue/locale", it doesn't work for
"merengue/block/locale" for example.

There surely has to be a better way, maybe it would be easier to just
copy the "en" folder for each "locale" directory, and rename it to
"pt".

If you find a good way to create the translations for the
merengue-folder, let me know!

On Sat, Feb 11, 2012 at 5:24 PM, Paolo <calvi...@gmail.com> wrote:
> I have sucessfully added a new language (Portuguese) using the ./
> manage.py sync_transmeta_db command, how can I then generate the .po
> files for translating the rest?
>
> Thanks!



--
--
Jorge correa herrero
Yaco Sistemas S.L. | http://www.yaco.es
C/ Rioja 5, 41001 Sevilla (España)
Teléfono: (+34) 954 50 00 57 | Fax (+34) 954 50 09 29

Jesaja Everling

unread,
Feb 13, 2012, 4:22:47 AM2/13/12
to merengue-...@googlegroups.com
You are correct of course, I never thought about putting the new
language into settings.py.
Do you have any advice on how to create the .po files for the "merengue" folder?

Jorge Correa Herrero

unread,
Feb 14, 2012, 5:56:35 AM2/14/12
to merengue-...@googlegroups.com


2012/2/13 Jesaja Everling <jeve...@gmail.com>

You are correct of course, I never thought about putting the new
language into settings.py.
Do you have any advice on how to create the .po files for the "merengue" folder?

In this other case it´work in the same way as a default django aplication so you need to create a folder for your language inside of the aplication locale folder, For example:
cd merengueproject/locale
mkdir es
mkdir pt
cd ../
manage.py makemessages -a
and now you have translation of default messages for Spanish and Portuguese, after you translate, remember to do a compile
Reply all
Reply to author
Forward
0 new messages