- $doc = file("../help/$user_language/$helpdir[$i]");
- $help_info = get_info($doc, 0);
- echo '<li><a href="../src/help.php?chapter=' . ($i+1)
- . '">' . $help_info[0] . '</a>' .
- html_tag( 'ul', $help_info[2] );
+ if (file_exists("../help/$user_language/$helpdir[$i]")) {
+ // First try the selected language.
+ $doc = file("../help/$user_language/$helpdir[$i]");
+ $help_info = get_info($doc, 0);
+ $toc[] = array($i+1, $help_info[0], $help_info[2]);
+ } elseif (file_exists("../help/en_US/$helpdir[$i]")) {
+ // If the selected language can't be found, try English.
+ $doc = file("../help/en_US/$helpdir[$i]");
+ $help_info = get_info($doc, 0);
+ $toc[] = array($i+1, $help_info[0],
+ _("This chapter is not available in the selected language. It will be displayed in English instead.") .
+ '<br />' . $help_info[2]);
+ } else {
+ // If English can't be found, the chapter went MIA.
+ $toc[] = array($i+1, _("This chapter is missing"),
+ sprintf(_("For some reason, chapter %s is not available."), $i+1));
+ }