Great great module - was lacking i18n support, quick patch to fix:

(Please review - not sure this is optimal...)

Enjoy!

(This will search the current language, find out if the help text (i.e. node) is in the current language, and if not it will replace it with the translated node and path so the link always shows helps in the CURRENT browser language, of course it depends on the multilingual settings of your site...)

CommentFileSizeAuthor
#2 patch.i18n.patch1.07 KBasak
patch.i18n.patch1.21 KBasak

Comments

robertdouglass’s picture

Status: Needs review » Needs work

Thanks. First comment - you're changing two things here, and that's generally not a good practice for submitting patches. You're doing the i18n thing (an obvious bug), and you're deciding that there shouldn't be a popup window. The second part needs to be taken out of the patch so that we just focus on fixing the bug.

asak’s picture

StatusFileSize
new1.07 KB

Sorry 'bout that - added support for Popups API (added "popups" class) on my site and missed that in the patch...

Attached a cleaner one

robertdouglass’s picture

So my next complaint is that we can probably cut down on the extra path* variables.

 function theme_helpinject_topic($nid) {
   if (user_access('view advanced help popup')) {
+    global $language;
     $node = node_load($nid);

// get rid of this... see below
+    $path = 'node/' . $node->nid;
+    // Check if current language is the help language, if not switch the node
+    if ($node->language != $language->language) {

// don't need this line
+      $path2 = array();

// here's how we get rid of $path
+      $path2 = translation_path_get_translations( 'node/' . $node->nid);
+      $path3 = 'helpinject/' . $path2[$language->language];
+    }
+    else {
+    $path3 = 'helpinject/node/' . $node->nid;
+    }
     drupal_add_css(drupal_get_path('module', 'advanced_help') . '/help-icon.css');
-    return l('<span>' . t('Help') . '</span>', "helpinject/node/$nid", array(
+    return l('<span>' . t('Help') . '</span>', $path3, array(

// maybe try something like
if ($translations =  translation_path_get_translations( 'node/' . $nid)) {
 $path =  'helpinject/' . $translations[$language->language];
}
else {
 $path =  'helpinject/node/' . $nid;
}
robertdouglass’s picture

@asak - do you want to pursure this further? Your help is appreciated.