locale_inc_callback() is a thing of the past

Damien Tournoud - November 11, 2008 - 00:45
Project:Drupal
Version:7.x-dev
Component:locale.module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

With the registry, there is no need for this old beast anymore.

#1

Damien Tournoud - November 11, 2008 - 00:52
Status:active» needs review

And here's the patch.

AttachmentSizeStatusTest resultOperations
332725-rip-locale-inc-callback.patch2.53 KBIdleFailed: 7020 passes, 58 fails, 11 exceptionsView details

#2

lilou - November 11, 2008 - 00:56
Status:needs review» needs work

again 1 :

+          if (drupal_function_exists('_locale_parse_js_file')) {
+            locale_inc_callback('_locale_parse_js_file', $filepath);
+            watchdog('locale', 'Parsed JavaScript file %file.', array('%file' => $filepath));
+            $parsed[] = $filepath;
+            $new_files = TRUE;
+          }

#3

lilou - November 11, 2008 - 01:07
Status:needs work» needs review
AttachmentSizeStatusTest resultOperations
issue-332725.patch2.38 KBIdleFailed: Failed to install HEAD.View details

#4

Damien Tournoud - November 11, 2008 - 02:02

Well spotted lilou, but we need to keep the function call!

Here is a reroll. Ran the test suite, 100% pass.

AttachmentSizeStatusTest resultOperations
332725-rip-locale-inc-callback.patch2.51 KBIdleUnable to apply patch 332725-rip-locale-inc-callback_0.patchView details

#5

System Message - November 16, 2008 - 22:00
Status:needs review» needs work

The last submitted patch failed testing.

#6

Gábor Hojtsy - November 17, 2008 - 10:38

A closely related issue is #187398: Re-split locale module which should be followed up, fixed and committed to Drupal 7 as well. Locale.inc is basically all locale.module subfunctionality, and is not at all shared in the whole system. Locale functions like t() are elsewhere, not in locale.inc. So locale.inc should move under locale.module and named like other Drupal sub-module includes are now named.

#7

lilou - November 17, 2008 - 13:38

#8

catch - November 20, 2008 - 21:12
Status:needs review» needs work

Looks like we could remove this nested if:

<?php
        
if (substr($filepath, 0, strlen($dir)) != $dir) {
+          if (
drupal_function_exists('_locale_parse_js_file')) {
?>

#9

Gábor Hojtsy - November 26, 2008 - 09:31
Status:needs work» needs review

This patch includes other places where inclusion of locale.inc was explicit and not implicit through locale_inc_callback. These should now also make use of drupal_function_exists(). This gets us much closer to execute a simple patch at #187398: Re-split locale module (which requires these changes or would need to modify incldue paths from includes/locale.inc to modules/locale/locale.admin.inc or so).

Please review this patch since it holds up #187398: Re-split locale module which holds up further nice developments (at least I have some cool ideas :) on locale functionality.

AttachmentSizeStatusTest resultOperations
locale_inc_callback.patch5.73 KBIdleUnable to apply patch locale_inc_callback.patchView details

#10

drewish - December 26, 2008 - 20:14
Status:needs review» needs work

I ran through the install in English and it worked fine but after grabbing the Traditional Chinese D6 language set (there aren't any D7 ones yet) and then re-running the installation I got the following warning:

Notice: Undefined index:  locale in /Users/amorton/Sites/dh/install.php on line 558

Call Stack:
    0.0049     375236   1. {main}() /Users/amorton/Sites/dh/install.php:0
    0.0081     597108   2. install_main() /Users/amorton/Sites/dh/install.php:1189
    0.1237    6350756   3. install_select_locale() /Users/amorton/Sites/dh/install.php:111

And no languages were displayed. I'm not sure if it was because there's a difference in D6 and D7 translations or a bug in the patch.

#11

drewish - December 26, 2008 - 20:17

After reverting the patch I notice that there's more warnings but the form actually appears. It seems like the call to drupal_get_form('install_select_locale_form', $locales); at the bottom of install_select_locale() isn't finding the form.

#12

sun - May 24, 2009 - 03:19

Most probably because the registry has no idea of Locale module / locale.inc during installation. #310467: Slimmer hook_theme() contains a fix for this, which allows us to load locale.module + locale.inc in maintenance mode.

#13

Gábor Hojtsy - May 24, 2009 - 11:28

Uhm, well #187398: Re-split locale module is quite important for any future development on locale module to happen, so it would be good to bring this forward, so we can get that committed too and get over the cleanups with actual feature development (eg. cleaning up the very dated locale UI).

#14

Gábor Hojtsy - June 11, 2009 - 10:56
Status:needs work» postponed

Turns out that #310467: Slimmer hook_theme() would not help solve this issue, because locale.inc is not at all in the locale module's location and is not referenceable through its info file. Ironically, for that to happen, we would need to fix #187398: Re-split locale module first, which was marked postponed on this issue. So looks like our circle is back to fixing #187398: Re-split locale module first and mark this postponed on that.

#15

andypost - January 8, 2010 - 14:34
Status:postponed» needs work

Make it active 'cos fixed #187398: Re-split locale module

Now all form-related staff is moved to locale.admin.inc

#16

andypost - February 22, 2010 - 01:28
Status:needs work» needs review

Because locale.inc is loaded in locale_init() and used only in locale_js_alter() there's no reason to save locale_inc_callback()

AttachmentSizeStatusTest resultOperations
332725-locale_inc_callback_d7.patch1.86 KBIdleFAILED: [[SimpleTest]]: [MySQL] 17,731 pass(es), 3 fail(s), and 0 exception(es).View details

#17

System Message - February 22, 2010 - 01:50
Status:needs review» needs work

The last submitted patch, 332725-locale_inc_callback_d7.patch, failed testing.

#18

andypost - February 22, 2010 - 02:29
Status:needs work» needs review

Forget to include changed tests

AttachmentSizeStatusTest resultOperations
332725-locale_inc_callback_d7.patch4.68 KBIdlePASSED: [[SimpleTest]]: [MySQL] 17,899 pass(es).View details

#19

andypost - February 22, 2010 - 03:06

Added comment about locale_js_alter() could be called from simpletest after installing locale.module so locale_init() is not called

include_once() changed to require_once() to unify with other tests

AttachmentSizeStatusTest resultOperations
332725-locale_inc_callback_d7.patch4.7 KBIdlePASSED: [[SimpleTest]]: [MySQL] 17,905 pass(es).View details

#20

Dries - February 22, 2010 - 19:58

+++ modules/locale/locale.module 22 Feb 2010 03:02:56 -0000
@@ -766,6 +756,9 @@ function locale_js_alter(&$javascript) {
+  // Could be called from simpletest without locale_init().
+  require_once DRUPAL_ROOT . '/includes/locale.inc';

I think it is odd that we specifically reference Simpletest here.

#21

andypost - February 22, 2010 - 20:29

Changed comment, locale_init() sometimes could be skiped

AttachmentSizeStatusTest resultOperations
332725-locale_inc_callback_d7.patch4.71 KBIdlePASSED: [[SimpleTest]]: [MySQL] 17,888 pass(es).View details

#22

Dries - February 22, 2010 - 20:53
Status:needs review» fixed

Good! Committed to CVS HEAD. Thanks.

#23

System Message - March 8, 2010 - 21:00
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.