Translation of home made plugins

50 views
Skip to first unread message

Iwe Muiser

unread,
May 2, 2013, 9:35:56 AM5/2/13
to omek...@googlegroups.com
I was wondering if anyone could give me some hints on how to start the translation of my own plugins. 

I've tried to incorporate as much __() as possible, but now I am stuck on where to start the translation. I see there is this build.xml file in all the translated plugins, but I don't what I should use to load it.

I suppose this analyzes the code and finds all the __() functions. Than it makes some templates that can be used to do the actual translations. Please help me out!

mjlassila

unread,
May 2, 2013, 10:01:55 AM5/2/13
to omek...@googlegroups.com
Hi,

I have used xgettext to filter out translated UI strings from PHP files. Good instructions how to use xgettext is available at http://www.lxg.de/code/playing-with-xgettext

xgettext utility generates POT-files you can use to create the actual translation. For some projects, I have used poedit (www.poedit.net/‎), but usually a good text editor is everything you'll need. If you are using a text editor, you''ll have to use gettext utilities  to create binary .mo files out of plain text .po -files. Poedit creates .mo files automatically.

To actually use the created translation, you have to initialize the translation during plugin load. Most likely you'll figure this out by reading source code of one of the translated plugins. 

-- Matti

Jeremy Boggs

unread,
May 2, 2013, 10:37:09 AM5/2/13
to omek...@googlegroups.com
Like the Omeka folks, we have a build.xml file in all our plugins to run xgettext and generate the POT files. You can check out the one for NeatlineTime at https://github.com/scholarslab/NeatlineTime/blob/master/build.xml#L336

Also like the Omeka folks, we use Transifex for hosting and getting translations from folks. The interface is pretty good, and makes it easy for folks to contribute translations without having to install Omeka or run anything themselves. Here's the page for Neatline Time translations:


Omeka on Transifex:


To activate a particular translation, check out the Omeka documentation page for Configuring Language:


Best,
Jeremy

On May 2, 2013, at 10:01 AM, mjlassila <matti....@gmail.com> wrote:

Hi,

I have used xgettext to filter out translated UI strings from PHP files. Good instructions how to use xgettext is available at http://www.lxg.de/code/playing-with-xgettext

xgettext utility generates POT-files you can use to create the actual translation. For some projects, I have used poedit (www.poedit.net/), but usually a good text editor is everything you'll need. If you are using a text editor, you''ll have to use gettext utilities  to create binary .mo files out of plain text .po -files. Poedit creates .mo files automatically.

To actually use the created translation, you have to initialize the translation during plugin load. Most likely you'll figure this out by reading source code of one of the translated plugins. 

-- Matti

On Thursday, May 2, 2013 4:35:56 PM UTC+3, Iwe Muiser wrote:
I was wondering if anyone could give me some hints on how to start the translation of my own plugins. 

I've tried to incorporate as much __() as possible, but now I am stuck on where to start the translation. I see there is this build.xml file in all the translated plugins, but I don't what I should use to load it.

I suppose this analyzes the code and finds all the __() functions. Than it makes some templates that can be used to do the actual translations. Please help me out!

--
You received this message because you are subscribed to the Google Groups "Omeka Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to omeka-dev+...@googlegroups.com.
To post to this group, send email to omek...@googlegroups.com.
Visit this group at http://groups.google.com/group/omeka-dev?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Iwe Muiser

unread,
May 7, 2013, 5:32:24 AM5/7/13
to omek...@googlegroups.com
Thanks for this information. I will try out some of the programs you mention. I'm still not sure about the xml, but I think since we have fairly small plugins that perhaps that would be overkill.
I'll report back when I'm in trouble or after my translation adventures.

John Flatness

unread,
May 7, 2013, 9:17:15 AM5/7/13
to omek...@googlegroups.com

Just like Matti posted, we use the GNU gettext tools to read translatable strings out of the source code. We also use them to remove duplicate translations and compile the translations.

The build.xml files are just Ant build scripts: we use them to automate this process a little bit. You don't need to have or use Ant to translate a plugin, but it makes things easier.

-John

Iwe Muiser

unread,
May 8, 2013, 8:51:45 AM5/8/13
to omek...@googlegroups.com
Thanks! I've got it figured out and working. 

The only problem seems to be that Omeka isn't refreshing the language file every time a page is loaded. So the translations are not directly visible. Is there a way to refresh this manually?

-Iwe
Reply all
Reply to author
Forward
0 new messages