Today while trying to install Drupal 7 with a different language I followed the instructions in the installer only to come up empty and resort to digging into the code. The instructions read

If an alternative translation package of your choice is available, download and extract its contents to your Drupal root directory.
Return to choose language using the second link below and select your desired language from the displayed list. Reloading the page allows the list to automatically adjust to the presence of new translation packages.

Note that it says Drupal root

After looking at the code the translations should be stored within a profile and within a translations folder.

/**
 * Find all .po files for the current profile.
 */
function install_find_locales($profilename) {
  $locales = file_scan_directory('./profiles/' . $profilename . '/translations', '/\.po$/', array('recurse' => FALSE));
  array_unshift($locales, (object) array('name' => 'en'));
  return $locales;
}

At this point I'm not sure if its the documentation that is incorrect or if this piece of drupal is being worked on. A look at CVS as well as the issues queue didn't show much work being done in this area and profiles seems to be the right way to go. This leads me to believe that this is just a documentation bug.

CommentFileSizeAuthor
#5 drupal-7-translation-filename.patch858 bytesgábor hojtsy

Comments

damien tournoud’s picture

The instructions are telling you to uncompress the translation tarball in the Drupal root directory, which is perfectly correct. The tarball will contain files like modules/system/translations/fr.po which will thus be in the correct folder.

The instructions seems correct, but of course the process is not easy to get right.

jredding’s picture

but this isn't what happens. The only 7 translation right now is in Ukrainian. When you download and uncompress the tarball you get a folder called uk-ua and not modules/system/translations/uk-ua.po

http://drupal.org/project/uk-ua

If the instructions are correct then the tarballs on d.o are incorrect. What am I missing here?

There were my steps.
1) CVS down the latest copy of D7 from head
2) Started the installation process
3) Went to http://drupal.org/project/translations and found a D7 translation (Ukranian)
4) Downloaded and put the tarball into the Drupal root directory
5) uncompressed it
6) discovered that the uk-ua tarball only created a uk-ua folder

Also you state

The tarball will contain files like modules/system/translations/fr.po which will thus be in the correct folder

This is stating that translations should go into the root of the system folder; which is inconsistent with the code (at least I can't find how this would work) and doesn't work (if I put uk-ua.po within modules/system/translations it doesn't work)

I'm not attempting to translate a module, I'm trying to install a translation for the entire system during the installation process by following the instructions at /install.php?profile=default&localize=true

damien tournoud’s picture

Project: Drupal core » Drupal.org infrastructure
Version: 7.x-dev »
Component: install system » Packaging
Assigned: jredding » Unassigned

Let's move to the infrastructure queue.

I'm not sure if this is a bug of the Urkranian translation, of if our packaging script needs to be reconfigured to generate proper file structures.

At the very least, you can try to download and install a D6 translation tarball, it should work pretty much the same at this stage of the Drupal 7 development.

jredding’s picture

OK now that makes sense. I downloaded several D6 stable translations and most of them contained the structure you outlined earlier. They weren't all consistent however.
For example
Filipino, Chinese Simplified & Traditional, Finnish, German, Greek and others were properly formatted

but Esperanto and Ukrainian were not properly formatted for Drupal 6.
http://drupal.org/project/uk
http://drupal.org/project/eo

Also both versions of the Ukrainian Drupal 7 release are incorrectly packaged.
http://drupal.org/project/uk
http://drupal.org/project/uk-ua

Is the packager doing the formatting or are we relying on the community developer(s) to create the proper structure (makes sense to me) in CVS (thus creating the tarball). If the latter is the case maybe we can (should?) write a script that checked for the folder structure for the obvious top level hierarchy (modules, profiles, themes, etc. ). A test so to speak.

Thanks for the quick responses btw

gábor hojtsy’s picture

Title: Incorrect language, or bug in the functionality » Drupal 7 translation packaging uses pre-Drupal 6 package code
Project: Drupal.org infrastructure » Project
Version: » 6.x-1.x-dev
Component: Packaging » Releases
Status: Active » Needs review
StatusFileSize
new858 bytes

The problem is that the packaging script only deals with Drupal 6 or other versions. The "other versions" it assumes to be "earlier", but with Drupal 7, that is not the case anymore. The simplest is to just fix the version check. We might also want to clean up function names to conform to these rules.

Packaging did not change from Drupal 6 to 7, so the same rules should apply. See attached patch.

dww’s picture

Patch looks good, thanks.

I ran the following query to find all existing D7 translation releases:

mysql> SELECT prn.nid, prn.pid, prn.version, prn.rebuild FROM project_release_nodes prn INNER JOIN term_node rtn ON prn.nid = rtn.nid INNER JOIN term_node ptn ON prn.pid = ptn.nid WHERE rtn.tid = 103 AND ptn.tid = 29 GROUP BY prn.nid;
+--------+--------+-------------+---------+
| nid    | pid    | version     | rebuild |
+--------+--------+-------------+---------+
| 304636 | 303830 | 7.x-1.x-dev |       1 | 
| 462902 |  21972 | 7.x-1.x-dev |       1 | 
+--------+--------+-------------+---------+
2 rows in set (0.00 sec)

Luckily, both are just -dev snapshots. So, I moved the old tarballs out of the way, and reran packaging on these two projects.

Can someone who knows what they're looking for verify that the tarballs for the following are now correct:

uk-ua 7.x-1.x-dev
uk 7.x-1.x-dev

? Please report back here, and assuming everything looks fine, I'll officially commit and deploy this.

Thanks,
-Derek

p.s. Side note: what's up with http://drupal.org/project/uk vs. http://drupal.org/project/uk-ua ?

tstoeckler’s picture

Actually neither are in the correct format. What you expect is basically a replica of a typical Drupal install, at least from the directory structure, except that, of course, the only files are translation files. Just a note, for further verification.

gábor hojtsy’s picture

@dww, @tstoeckler: the problem is with the source files not the packager (after the patch :). Look at http://cvs.drupal.org/viewvc.py/drupal/contributions/translations/uk-ua/... (which only has uk-ua.po which is not a dead/removed file) and http://cvs.drupal.org/viewvc.py/drupal/contributions/translations/uk/?hi... (which does not seem to have any file whatsoever on that branch).

dww’s picture

Status: Needs review » Needs work
Issue tags: +needs drupal.org deployment

Ok, committed to HEAD. This just needs to be deployed now.

dww’s picture

Status: Needs work » Fixed
Issue tags: -needs drupal.org deployment

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.