Recent Topics

1 Apr 24, 2008 19:04    

Does the messages.pot file need to follow any rules about what order the lines show up in? Like, normally messages.pot (and global.php and messages.po) seem to be in basically the same order the translatable strings are found in the plugin that is being translated, but is that "THE LAW" or just a habit that comes from using whatever it is that normally makes a messages.pot file?

In other words can I make a messages.pot file that has the strings in alphabetical order instead of line-numerical?

Of course if a translatable bit is duplicated then we have two line numbers for the same translatable bit, which more or less throws off the idea of "line-numerical" but I should do a quick cheap example to illustrate. So normally I would expect something like this in messages.pot:

#: ../_myplugin.plugin.php:1
msgid "Giraffe"
msgstr ""

#: ../_myplugin.plugin.php:2
msgid "Zebra"
msgstr ""

#: ../_myplugin.plugin.php:3
msgid "Alligator"
msgstr ""


So can I make it be this instead and expect it to work:

#: ../_myplugin.plugin.php:3
msgid "Alligator"
msgstr ""

#: ../_myplugin.plugin.php:1
msgid "Giraffe"
msgstr ""

#: ../_myplugin.plugin.php:2
msgid "Zebra"
msgstr ""

2 Apr 24, 2008 20:10

I believe there are no order rules, since b2evo search the string through the whole global.php file.
I successfully merged and changed the order in messages.pot files.

3 Apr 24, 2008 20:19

Thanks friend! Now creating messages.pot and eventually fully or partially translated plugins will be very easy.

Search the plugin for translatable bits.
Stash each bit with it's line number in an array.
Sort the array by alphabet.
Output the appropriate bits for the messages.pot file.

Hooray for translatable plugins!

4 Apr 25, 2008 03:30

Okay one more question...

I have an automated method to create a messages.pot file that eventually I will give away to anyone who wants it. It assumes $this->T_('foo') is what will be translated, and unfortunately doesn't even try to deal with something like $this->T_('doesn\'t') - which is technically legal I guess but won't work with my little hack job.

I'm thinking about the locales/ab_CD/_global.php and locales/ab_CD/LC_MESSAGES/messages.po files that actually be a translation. Should I try to create a "sample" translation package (the two files), or should I leave that up to the actual translator to do?

Perhaps the best solution here is to provide 2 tools. One for the plugin author to create messages.pot, and another for the translator to create _global.php from the messages.po file that poedit created?

Thoughts?

5 Apr 25, 2008 03:53

A sample translation files are needed when somebody wants to create a very first translation, so he don't have to create and name files/folders.

But a tool, which can automatically create _global.php without uploading messages.po in existing system, is very useful.

Now these two steps creating messages.pot and extracting _global.php take too much time, at least for Windows users. :(


Form is loading...