Skip to main content
Known Participant
July 3, 2009
Question

TOC Auto-Sync and Custom Buttons

  • July 3, 2009
  • 1 reply
  • 2533 views

I have two CHM files.

One contains English content, the other has French content.  We're okay with having to change Windows display language to French in order to see the localized interface.  It would be great to force it to French without having to do that, but it's better than nothing.

I have a handy dandy little javascript in my master page to flip between topics in the two CHM files.  This is where my problems begin.

My flipping back and forth works great but the TOC does not auto-sync despite me having that checkbox enabled on the windows in both projects.

Then I added a Custom Button in each project (let's call it Cat in English and Chat in French) that points to a Redirect Topic (using the meta refresh method) to launch a Remote Topic.  The redirection works great but again, the TOC does not auto-sync.

Getting back to my English/French setup... let's say I'm in the English project CHM, I change my display language to French, all of the interface buttons change to French except my Custom Button which is still "Cat".  From what I've read, I'm guessing there's no way around this?  I'd rather not have to put "Cat/Chat" for the Custom Button text or leave it as is where it will stick out like a sore thumb unless my display language always matches my language content.

Any suggestions or am I stuck with what I have?

This topic has been closed for replies.

1 reply

Captiv8r
Legend
July 3, 2009

Hi there

I'm a bit confused to say the least.

You have two different CHM files, right? One in English and one in French.

I'm assuming your JavaScript allows displaying the matching topic from the other language? If so, isn't the matching topic simply replacing the topic that was there before? Here's where it gets real fuzzy. The TOC should already be synced to the topic. Are you saying it loses focus or something?

If there are two projects, one in English and one in French, each project would have its own Custom Button definition, right? So why not enter Chat in the French project?

Personally, assuming I'm correctly understanding this setup, I would think you are somewhat asking for trouble if you allow a click within a topic to change the language. I would think it to be a better solution just to keep the user inside the same help file. Choose the language at the beginning if you like, but remain in that language until the file is closed.

Cheers... Rick

Helpful and Handy Links

Known Participant
July 3, 2009

You have two different CHM files, right? One in English and one in French.

Correct... one English, one French.

I'm assuming your JavaScript allows displaying the matching topic from the other language? If so, isn't the matching topic simply replacing the topic that was there before? Here's where it gets real fuzzy. The TOC should already be synced to the topic. Are you saying it loses focus or something?

My javascript determines the matching topic from the other CHM and changes the window location to the other topic.  If I'm in the English help, on an English topic and click my French link, the link opens the corresponding French topic but my TOC never changes to the French TOC - it's still showing the English one.

If there are two projects, one in English and one in French, each project would have its own Custom Button definition, right? So why not enter Chat in the French project?

I would have Chat in the French project for the Custom Button... the confusion would be if I open the French CHM while my Windows display language is English or change my Windows display language to French and open the English CHM.  In those scenarios, the interface buttons will be correct but the Custom Button text will match the content language rather than the interface language - that's when it will look wrong.

Personally, assuming I'm correctly understanding this setup, I would think you are somewhat asking for trouble if you allow a click within a topic to change the language. I would think it to be a better solution just to keep the user inside the same help file. Choose the language at the beginning if you like, but remain in that language until the file is closed.

Ah, but the end users want on-the-fly translation by topic without having to open the other CHM and find the topic all over again.  This is CSH, so the user may very well have gotten directly to a topic and would like to see the other language immediately.  Essentially, it should be as though the user closed the current CHM, opened the other CHM and located the exact same topic - instantaneously

Participating Frequently
July 6, 2009

Hi,

I just tried what you wrote in the post at that link and boy, oh boy, the wysiwyg editor is having an absolute field day changing what I type

To test, I put just the shortcut object in my Master Page...  it now brings up a window saying "Cannot open the file: ms-its:MyFrench.chm" within a window entitled Help.  MyFrench.chm is in the same folder as MyEnglish.chm.  Inside topics within subfolders, wouldn't the path not know where the other .chm would be?  Plus, as mentioned in my previous post, I'm assuming my href would have to alter the param value to include the destination topic at runtime.

<object
  classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"
    type="application/x-oleobject">
  <param  name="Command"  value="Shortcut" />
  <param  name="Font"  value="MS Sans Serif,12,0,," />
  <param  name="Item1"  value=",hh.exe,ms-its:MyFrench.chm" />
</object>

As for the button labels, using a generic word might work but that was going to be my next question.  For some odd reason, in "Tri-pane Tabs and Windows" on the Window Properties window, I have the option to turn things on and off such as Glossary, Search Tab, etc. but TOC & Index are paired.  I want to turn off/rename the native Index because my Custom Button would be called Index and point to a different CHM.  If I can't turn off/rename the native Index, I'd end up with an Index tab and an Index button that point to two different things - a wee bit confusing

I can "break" the native Index by going into Advanced Properties and putting garbage text in the textbox for Index - it then magically disappears when I generate and look at my .chm.  I thought perhaps I could go into Project Settings>Language>Advanced and on the LNG File tab, change Index=Index to be Index=Something and that I'd see that as the tab title when I regenerated... no such luck.


I agree with Elisa that switching between the two Help files may be distracting to your users. However, if this is something that you're still keen to do, you can achieve it by linking all your topics to a JavaScript (.js) file that contains the function below.

function SwitchLanguage(TargetHelpFile,TopicFile) {

// Construct an HTML Help Close control with which to close the current Help
// file.

   Close =    "<object id='Close' classid='clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11'>" +
              "<param name='Command' value='Close'>" +
              "</object>";

// Add the Close control to the current topic, and click it.

   document.body.insertAdjacentHTML("BeforeEnd",Close);
   document.Close.hhclick();

// Construct an HTML Help Shortcut control with which to open the required topic
// in a new Help window.

   Shortcut = "<object id='Shortcut' classid='clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11'>" +
              "<param name='Command' value='Shortcut'>" +
              "<param name='Item1' value=',hh.exe,ms-its:" + TargetHelpFile + "::/" + TopicFile + "'>" +
              "</object>";

// Add the Shortcut control to the current topic, and click it.

   document.body.insertAdjacentHTML("BeforeEnd",Shortcut);
   document.Shortcut.hhclick();

}

Then you code the hyperlinks between the two files like this:

<a href="JavaScript:SwitchLanguage('french.chm','topic1.htm')">Text that user clicks</a>

where "french.chm" is the name of the target Help file, and "topic1.htm" is the file name of the required topic.

There is a lot of scope for enhancing the script, especially when the file names of the topics in the French Help file are identical to those in the English file. I've illustrated this in the sample files that I've uploaded here:

http://rapidshare.com/files/252570423/Help_Sample.zip.html

In these examples, the script determines the names of the current Help file and topic file and then creates a link on the fly to the equivalent topic in the second Help file. Would be interested to know if this goes some way towards meeting your needs.

Pete