Locale module creates an interfacet translations directory when it is enabled. Only multi sites Drupal installations may benefit from having this directory. Manual and automatic translation import don't need it. This is a follow-up issue for #1804688: Download and import interface translations.

This issue will investigate the detailed consequences of changing the default and if possible, will make Locale module no longer create a translations directory by default.


YesCT’s picture

That sounds opposite from the follow-up that we needed. We want locale to create this directory, so we dont get the errors about the temp ... see #1804688-64: Download and import interface translations screen 08, #1804688-67: Download and import interface translations screen s06b, #1848490-5: Import translations automatically during installation screen 08.

@Sutharsan please explain more.

Sutharsan’s picture

I'm working on a solution in #1804688: Download and import interface translations. In my sandbox I have now:

 * Implements hook_install().
function locale_install() {
  // @todo Automatic translations download/import does not need the translations
  // directory to exist. Only multi site installations may benefit from having
  // this directory. A follow up issue will change this default:
  // http://drupal.org/node/1851442

  // Create the interface translations directory and ensure it's writable.
  $directory = variable_get('locale_translate_file_directory', conf_path() . '/files/translations');
  file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);

This should solve the directory problem in the patch. But the directory is not needed for automatic import nor for manual import. In the current code it still is required due to the way the manual import works. But after the patch landed, the directory is only needed for multi site installations which share their translations. Changing the directory default has bigger impact than just the code in the patch. It affects various test, the installation process and the manual import. That is beyond the scope of the patch and should hold it up too much.

The error you reported does not always occur. Webchick didn't have the problem when she tested the patch. I did not have the error when I re-installed drupal after deleting the existing translations directory. I think only occurs when php can not write in the directory.

Gábor Hojtsy’s picture

Title: Don't create an interface translations directory by default » Create an interface translations directory by default

In my mind, it makes a ton of sense to default to create this directory, because in an ideal Drupal dev/staging/live environment, the .po files are pushed from dev/staging to live, so you update translations is staging and verify the updates and then push the files to live. So live would take files from a local directory (need this local directory) while staging would need to keep the files so they can be pushed to live (so need this local directory).

I understand in a single-site (no dev/staging/live) scenario, keeping the files around might not be needed, but I don't see where that hurts, so I'd rather prefer it to work like that keeping the downloaded files by default, because that is best practice for both multisite and dev/staging/live setups.

Changed the issue title for this.

Gábor Hojtsy’s picture

Also given the patch does have this code in, looks like the task for this issue would be to remove that @todo :)

Sutharsan’s picture

Status: Active » Closed (fixed)

Although I personally prefer a clean site, i.e. don't save po files if it is not required, I see some benefits for single site installations too. Agreed to create and use the translations directory by default. I will remove the @todo from #1804688: Download and import interface translations.