This was working for me on simplytest.me earlier today, but it is not working on my local test site (which has an Internet connection).

I installed Drupal with the Standard profile, and then enabled all 4 Multilingual modules.

I went to admin/config/regional/language and added Spanish. (I later tried this with French and German as well, same result).

It went to a batch screen saying "Updating translations", "Completed 1 of 16" etc.

When the batch was finished, I got back to the Languages page and it showed me 0% translated. The Interface Translation page confirmed this -- nothing was translated. There were no messages in the dblog.

So then I went to
https://localize.drupal.org/translate/languages/es
and downloaded the 8.0-beta6 file for Spanish. I went to
admin/config/regional/translate/import
and imported the file there. This was a much longer batch process, and this worked. I ended up about 97% translated.

Any ideas what could be happening to make simplytest.me work and my site not? It seems like when I did it earlier today on simplytest.me there may have been more steps in the batch process when I added the language than what I saw on my site, but I am not familiar enough with the language add and import translations process to know what was missing.

CommentFileSizeAuthor
#2 trans-status.png19.14 KBjhodgdon
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhodgdon’s picture

I was wondering if I had my system misconfigured, such as a non-working tmp directory, but that is not the case. Still no idea what is happening.

jhodgdon’s picture

FileSize
19.14 KB

Another piece of data is that admin/reports/translations reports "Nothing to check" when I check manually. ??!?

jhodgdon’s picture

Title: When adding language, translation import is not working » When adding language, translation import is not working without Update module enabled
Related issues: +#1777106: Make check for out of date project update information more robust for sites that are not running cron regularly (follow-up)

Some other things I looked at:
- On admin/config/regional/translate/settings the translation source is set to " Drupal translation server and local files" (I had not updated that setting).

Ahhhhh.... It looks like there is a dependency on the Update module being installed. I'm looking at locale.translation.inc in function
locale_translation_get_projects()

It does this:

  if (empty($projects)) {
    // Get project data from the database.
    $row_count = \Drupal::service('locale.project')->countProjects();
    // http://drupal.org/node/1777106 is a follow-up issue to make the check for
    // possible out-of-date project information more robust.
    if ($row_count == 0 && \Drupal::moduleHandler()->moduleExists('update')) {
      module_load_include('compare.inc', 'locale');
      // At least the core project should be in the database, so we build the
      // data if none are found.
      locale_translation_build_projects();
    }
    $projects = \Drupal::service('locale.project')->getAll();
 

So it looks like if you don't have the Update module installed, you don't get any translation imports. I don't have it turned on.

That seems wrong to me. Is that the desired behavior? If so it should be documented somewhere, like in the locale module help it should say that you can't import translations if the Update module is not installed.

jhodgdon’s picture

Looking at the code, it appears that this is really an important dependency. When you are importing translations or checking if there are updates, you need to consider Core and all other Projects you've installed, so the Locale module depends on Update to get this information.

So probably the right fix is to document that the Update module is needed if you want to get any translations automatically from localize.drupal.org. In my opinion, we should add a note about this to:

a) The main locale_help() help topic page.
b) When adding a language, set a message if translations could not be imported because of this.
c) On the translation update status report. Or better yet actually that report should not be enabled if the Update module doesn't exist.
d) On the settings page for locale it should either not let you choose to use remote sources for translations, or it should at least tell you you need the Update module.
e) Other pages that depend on this? I am not sure, but there may be others.

Gábor Hojtsy’s picture

Yeah its kind of required and not :D if you enable update module THEN uninstall it, then locale will still have some cached data and use that for eternity (incorrectly). Update module is required to collect that data.

jhodgdon’s picture

Ok then on (c) on the Update Status report for translations, we should warn the user if Update module is not enabled that the Project list may be outdated.

Bès’s picture

There is also the case of custom modules that want to import their translations.
I see here that you need to include "interface translation" properties in the .info.yml to tell where the local .po is located, but you still need to have Update module active to import them.

Sutharsan’s picture

#1832946: Runtime translation download fallback works different from installer translation download fallback should be able to fix this problem. I tested with the latest patch (#85) and went through the steps in the issues summary:

  1. Standard Drupal installation
  2. Disable Update module
  3. Enable Language module and the 3 translation modules
  4. Added a language, added a second language.

With each added language, the translation are automatically downloaded.

Note that the reported problem only occurs with dev releases. For any module with a stable release the translation will be downloaded without Update module being enabled. With the solution in #1832946: Runtime translation download fallback works different from installer translation download fallback also modules with a dev release will get the latest translation from their branch (if available).

jhodgdon’s picture

Thanks very much for testing! It looks like we should mark this as a duplicate of that other issue then.