Help make decisions about Drupal 6 translation template standards! Just two questions!

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Gábor Hojtsy's picture

We face two important decisions when going forward with Drupal 6 development, and these should be answered before Drupal 6 code is frozen (in one month), so the core would be ready to handle the formats desired. Drupal 6 is supposed to get autolocale functionality (no, not the module itself, but a highly polished version of it's functionality) included, having improved support for running multiple operations sequentially under tight conditions (like shared hosts). So what type of translations templates we use will impact how Drupal performs and functions. Help shape our bright future!

The role of autolocale functionality is to import only the translations required on a site, helping the site perform much better. Of course it also gets better for the users, because we can get these translations imported automatically, but the performance improvement is much nicer. So we need to segment the translation templates to only what a user would enable on a site. Now every string appearing in multiple files ends up in general.pot, as well as output from small source files (less then 10 strings). Any larger file will get it's own translation template. With Drupal 6, these files will be shipped in a directory structure which combined with Drupal will resemble placement of contrib module translations, every module having it's own translations under it's directory.

The first question is how segmented the templates should be. Should we stick to a template per module, so even smaller modules get their own templates, not folded into general.pot, or should we keep small modules in general.pot? Separation would be helpful performance-wise. Common string would still stay in general.pot. What about modules with multiple files, like node.module, or system.module, which gets most of the include files? Should we have mega-files with one template per module there, or smaller files? This also has an impact on how can we import those, how much resources it takes to import a bigger file.

And here comes the second question. Drupal core translation templates (as of Drupal 5.x) also contain .info file string in general.pot, because you need module descriptions displayed to users before they enable the module, and before the translation of the module is automatically loaded. There is no solution for this for contributed modules though. As far as I have heard, many translation teams favor a "one translation template file per contributed module" solution for their work, but that does not allow importing of .info string earlier (Note that we can parse all the .po files at once, and try to grab out the .info translations, but if you suddenly copy 3-4 modules into your sites/all/modules folder and go to the modules screen, you would either get a PHP timeout or a progress bar before the module screen shows up, which are both "funny" results, not what you expect, and you would get disappointed). That is basically the same problem which warranted the "invention" of .info files in Drupal at the first place. So we can follow suit. A possible idea is to have very small translation files for .info files, resulting in at least two translation templates per module to translate.

Note that the automatic translation import system will allow for any number of translation files per module, named such as node-module.hu.po and node-module.de.po, as well as content_types-inc.hu.po and content_types-inc.de.po all in the same directory under modules/node/po. It is not a usability problem that people need to import multiple files, because they will not need to import it themselfs, Drupal wlll do it automatically. Especially if you help in making these crucial decisions. No need to code or patch anything, just add your two cents here!

Comments

I think that translations

meba's picture

I think that translations should be separated into modules. It's useful because we can then ship translation with modules (as now!).

what do you mean?

Gábor Hojtsy's picture

I'm afraid I am unable understand what do you mean here? Core translations or contrib translations? How should they get shipped?

I generally tend to more

kkaefer's picture

I generally tend to more smaller files for I think they are easier to handle. It is probably a psychological effect, but when I see that a translation file has only two strings left, I go on and translate these. If there are still 54 strings left, I can stop right away.

What about:

description[de] = Das ist die Deutsche Beschreibung.
description[fr] = C’est la description française.
[...]

directly in the .info files? We could do the same for fields like name or package, thus providing also localized module names. There are several ways this could work:

  • We let translators commit to .info files
  • We pull the module description from a field in the module translation node on drupal.org
  • We pull the module description from the .po file when the module is packaged

hm, into info files

Gábor Hojtsy's picture

Well, interesting idea to put translations into info files themselfs. We will surely not allow translators to commit to info files, as far as I see, your third option fits into the translation workflow. If we have translations for the .info file strings in any of the module .po files, we can copy those over to the .info file, when packaging. That only needs a small modification in code inserting new modules into the system table to also add these strings into the locale tables, so the module list will shine in the foreign language required. Hm, seems like a good idea.

While we're at it, we should

kkaefer's picture

While we're at it, we should make sure that the two following strings go into the translation template for each module (module name from .info file is "Foo"):

  • Foo ([Plain module name])
  • Foo module ([Name + module])

"Foo" is used on the module listing page and "Foo module" is used on the permission screen. Also, we need the module description in the .pot.

When a .info file is changed, a script has to be run that updates the templates for that module.

no translations in main contrib .info files, please...

dww's picture

this is a step away from a big part of what Gabor is going to be doing for SoC this year: each contrib translation will be in its own unique project. so, instead of translators mucking around directly in the module directory themselves, they own, maintain, tag, and release their own project, for the language/module combination(s) they care about. see http://drupal.org/node/105986 for more.

packaging

Gábor Hojtsy's picture

But we would still be able to package them together, given we have relations of translations and released versions. Do you think this is a bad idea? (It would be certainly easier not to implement a translation system for info files separately, but this could be an possibly elegant way to avoid having so many small translation files around).

packaging contrib translations

dww's picture

we could package them together, but in many cases users just want the functionality and no translations.

i was actually thinking more about packaging all translations from a given language into a giant language package for that language, not all the translations of a given contrib with each other. seems to me that most multilingual sites are going to care about a certain set of languages, and would be interested to see all the projects that have been translated to a given language at once. although, it makes sense that other sites would want to install whatever modules they need, and then want to see all the translations for those modules to see which languages the site could easily support.

other than namespace/versioning issues and potential confusion, there's no reason we couldn't have a bunch of different combinations packaged up:

  • only the contrib, no translations at all
  • all translations of a single contrib
  • all contribs for a singe translation
    ...

i just really don't want to see translations directly in the main module .info files, if at all possible. that just violates some of the principles of the refactoring into separate projects that i had in mind (and explained in http://drupal.org/node/105986)

acknowledged

Gábor Hojtsy's picture

While I don't agree that packaging translations into info files violates project separation substantially more then packaging translations into a subfolder, let different files rule. Neither of these is implemented in Drupal core yet, and I am not entirely sure how to ago about importing all translations for .info files, but will think about it some more.

As for giving overviews, it is better to have overview tables or lists or even better filters on the website, then providing a user with a monster package to download just to get information about what modules have a particular translation. I will look into this part more in my SoC work too. Just brainstorming here about the packaging formats for now, so we can build in support for them in Drupal 6 properly.

Answering your quetions

mcduarte2000's picture
  1. You should stick to a temple per module. It's much more practical that way, because you can easily review the expressions you translated to that module and maintain some logic. I prefer the mega file option, even if psychologically is not the best option.

  2. "have very small translation files for .info files, resulting in at least two translation templates per module to translate." - Not ideal, but nothing against.

Agreed. One file per module

dami's picture

Agreed. One file per module is preferred, it's easier to handle and manage. We usually prefer same person comlete working on translating one module, so that translations are at least consistent for this module.

Another concern about packing common strings to general.pot is, how do we distinguish strings that have different meanings/translations at different modules/paths/places. One example is 'view', in node editing, it's a verb, while in Views module it's a noun meaning well...View. Is there a way to distinguish them so translations can have a one to many mapping?

different meanings

Gábor Hojtsy's picture

Another concern about packing common strings to general.pot is, how do we distinguish strings that have different meanings/translations at different modules/paths/places. One example is 'view', in node editing, it's a verb, while in Views module it's a noun meaning well...View. Is there a way to distinguish them so translations can have a one to many mapping?

No, there is no way to distinguish between them now. And no packaging change would help that in itself. We are dealing with fixing up packaging for Drupal 6 here.