The Line
define("AUTOASSIGNROLE_ROLE_USER_TITLE", t("Role"));

causes the translation System to call the t() function before a locale is initialized.

this can be fixed in different ways:
1) directly in the locale.module

function locale($string) {
  global $locale;
  static $locale_t;
  
+  if (empty($locale)){
+	$locale =  locale_initialize();
+  }
	
  // Store database cached translations in a static var.

2) the autoassign.module (Method 1)
-define("AUTOASSIGNROLE_ROLE_USER_TITLE", t("Role"));
+define("AUTOASSIGNROLE_ROLE_USER_TITLE", "Role");

3) the autoassign.module (Method 2)
-define("AUTOASSIGNROLE_ROLE_USER_TITLE", t("Role"));
Replace every "AUTOASSIGNROLE_ROLE_USER_TITLE" by t("Role")

I would prefer the third Method. But placing the code from 1) can be a nice fix for every other buggy Module call.

Fixing this bug causes the page building being 50-80ms faster. The whole client-page-building process seems significant faster.

Best Regards
Passer

Comments

cyberswat’s picture

Any chance of you rolling a patch for option 3?

Passer’s picture

I guess opening the file and copy+replacing it all like described would fit more users, because not everyone knows how to apply a .patch file

Best Regards
Passer

cyberswat’s picture

The request for a patch was so that I could apply it to the dev branch and commit it

cyberswat’s picture

Assigned: Unassigned » cyberswat
Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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