[translations] Auto locale

Gabor Hojtsy gabor at hojtsy.hu
Sun Jan 14 15:23:28 UTC 2007


On Sun, 14 Jan 2007, Jakub Suchy wrote:
>> Done, I hope you can make use of it. Any improvements are welcome :)
>> http://drupal.org/cvs?commit=51243
>
> Thanks. These are very nice and easy to understand. Just creating a
> profile for -module.po doesn't work for me because you expect:
> // # Hungarian translation of Drupal (modules/aggregator/aggregator.module)
>
> I suggest we alter the script that it takes filename.po, strips "-module" and then copy translation to modules/filename ?
> Like: node-module.po -> node.po -> modules/node/po/
>
> My suggestion:
> $module = str_replace("-module.po", "", $filename);
> print "debug: $filename should go to modules/$module/po/$module.po\n";
> // copy...

I went into the code and started to implement this. But the problem is 
that it is not only about module files. Module files have included code 
files, and this is increasingly the situation in core. Like node.module 
has content_types.inc, which has a corresponding PO file. That file has 
nothing in its name about where it should go in the folder hierarchy, but 
it has the information put into the POT file by the extractor.

Now we either do a static list of files and where they should go, or we 
rely on the information which was put into the POT file by the extractor 
(so it should be there in PO files too). An example from the current 
aggregator-module.pot and content_types-inc.pot:

# $Id: aggregator-module.pot,v 1.8.2.3 2007/01/10 21:31:10 goba Exp $
#
# LANGUAGE translation of Drupal (modules/aggregator/aggregator.module)
# Copyright YEAR NAME <EMAIL at ADDRESS>
# Generated from file: aggregator.module,v 1.324 2006/12/26 10:28:12 dries
#

# $Id: content_types-inc.pot,v 1.1.2.2 2007/01/10 21:31:10 goba Exp $
#
# LANGUAGE translation of Drupal (modules/node/content_types.inc)
# Copyright YEAR NAME <EMAIL at ADDRESS>
# Generated from file: content_types.inc,v 1.24 2007/01/09 07:53:26 drumm
#

The packaging script expects this format. (It does allow for the path 
information to be on the first line too, because addition of the CVS Id 
was a recent change).

Gabor


More information about the translations mailing list