I'm running my Drupal site in Norwegian. However, when I tried to install a module from within Drupal, authorize.php was in English. AFAICT, the strings are actually translated.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plach’s picture

Component: language system » locale.module
crifi’s picture

Status: Active » Postponed (maintainer needs more info)

I don't understand your bug report. There are some calls of t() in authorize.php http://api.drupal.org/api/drupal/authorize.php/7/source
Can you give some example strings which doesn't works? Currently I see no reason why the translation shouldn't work...

hansfn’s picture

How can this be unclear - the strings in authorize.php just aren't translated. I looked closer at the code myself and realized that the locale module wasn't loaded and hence no strings translated. See attached patched (that fixes the issue for me).

crifi’s picture

I have a german translation of drupal 7. All HTTP pages with 403 status are called over authorize_access_denied_page() in authorize.php and they work, because the function t() calls locale() which loads the translation strings...
What do you mean with installation of a module in coherence with authorize.php?

hansfn’s picture

crifi, haven't you even tried to install a module the new way - by using the form on admin/modules/install?

Anyway, you can see the problem by just visiting authorize.php directly - with and without my patch.

NB! The function t() checks if the function locale exists, and then calls - big difference.

crifi’s picture

Version: 7.0 » 7.x-dev
Status: Postponed (maintainer needs more info) » Needs work

Please respect that I tried to reproduce your issue and wasn't able to comprehend your issue directly. It should be in your interest that the community proof your issue and help to clarify what's the exact problem. Thank you for your patience anyway.

For me it's clear now and I can reproduce it. With your patch installed, calling authorize.php directly without any rights the "Access denied" title string is still not translated (even if the string itself is in the translation). So I think your patch doesn't solve the whole issue, right?

hansfn’s picture

I think my comment sounded harsher than it was meant.

My patch solves the issue I reported. The problem you are seeing, is just a missing t call, isn't it?
Line 44 of authorize.php: drupal_set_title('Access denied');

crifi’s picture

Sure there is a t() missing, this is simple. But there are still some drupal_set_titles more without t() called (for example line 116):

  drupal_set_title($_SESSION['authorize_operation']['page_title']) )

So I've made a grep over the whole D7 code to proof if there is also a translation problem with these $_SESSION variables...
In modules/update/update.authorize.inc t() is called correctly, but in modules/system/system.module there is no call of t() when setting the page title to the session vars. I think there must be a t() call also?! Or we translate inside of the drupal_set_title() calls in authorize.php and revoke the t() call in update.authorize.inc ...

What's the Drupal way? ;-)

P.S. New patch file attached with the obviously missing t() call.

hansfn’s picture

OK, we are really moving beyond my knowledge, but I'm guessing that $_SESSION['authorize_operation']['page_title'] contains the translated string already. Calling t on a translated string normally doesn't change it - unless the translation by coincident is identical to some other English string.

If you look at the calls to system_authorized_init in modules/update/update.manager.inc you'll notice that the page_tite parameter is translated. system_authorized_init sets $_SESSION['authorize_operation']['page_title'].

crifi’s picture

Status: Needs work » Needs review

Okay, I agree. We have controlled that everything in the translation of authorize.php is okay right now. Under the presumption that the session var is already translated, we now need a review of somebody who knows if this is now the desired behavior.

Tor Arne Thune’s picture

Issue tags: +Update manager

Tagging this with Update manager to make it more simple to find for update manager maintainers (dww).

Tor Arne Thune’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7
Tor Arne Thune’s picture

albertosouza2’s picture

#8: 1021322-7-authorize-locale.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 1021322-7-authorize-locale.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone’s picture

Version: 8.9.x-dev » 7.x-dev
Issue summary: View changes
Issue tags: +Bug Smash Initiative

The patch here contains changes to authorize.php to add t() to the 'access denied' string. That was added to Drupal 8.0.x in #2192653: Remove drupal_set_title from authorize.php and resolves the problem in the Issue Summary. There are other suggested changes in that patch but track the history of those. So, I search for any D8/0 current issue related to this problem and was unable to find any. Therefore, I think it is safe to make this as outdated.

But before doing that I checked the D7 code and find that the changes to authorize.php could still be applied there. So, moving this to the Drupal 7 issue queue.