How can i make index like this: ААБВГДЕЖЗ...... instead of ABCDEF.... ?

Comments

rjerome’s picture

This is generated by the theme_biblio_alpha_line() function in the biblio_theme.inc file on lines 1023 to 1030 like this...

  for ($i = 65; $i <= 90; $i++) {
    if ($i == ord($current)){
      $output .= '<b>['.chr($i).']</b>&nbsp;';
    }
    else{
      $output .= l(chr($i), $path. chr($i), $options) .'&nbsp;';
    }
  }

If you were to wrap the "chr($i)" calls in t() then add the letters A thru Z to your translation file it should work. So you new code would look like this...

  for ($i = 65; $i <= 90; $i++) {
    if ($i == ord($current)){
      $output .= '<b>['.t(chr($i)).']</b>&nbsp;';
    }
    else{
      $output .= l(t(chr($i)), $path. (chr($i), $options) .'&nbsp;';
    }
  }

Let me know if this works and if it does, I'll put it in the code.

Ron.

perfectsense’s picture

then add the letters A thru Z to your translation file

Sorry, i can't understand that. My translation file (biblio-6.x-1.7.ru.po) contain strings like this:

#: biblio.module:779
msgid "Edit keyword information"
msgstr "Редактировать ключевые слова"

and not contain any alphabet symbols like ABCDE...
Where can i add letters A thru Z ?

rjerome’s picture

This is probably not the best way to do this, but lets just call it a proof of concept...

you would have to add (at the end of the file) lines like

msgid "A"
msgstr "A"

msgid "B"
msgstr "Б"

msgid "B"
msgstr "Б"

.... and so on for each character, but I guess this might not be the best solution since there is not a one to one correspondence between the Latin and Cyrillic character sets.

perfectsense’s picture

No, it's not working. When i insert this code:

  for ($i = 65; $i <= 90; $i++) {
    if ($i == ord($current)){
      $output .= '<b>['.t(chr($i)).']</b>&nbsp;';
    }
    else{
      $output .= l(t(chr($i)), $path. (chr($i), $options) .'&nbsp;';
    }
  }

i see only blank screen in Firefox and error 404 in Opera.

rjerome’s picture

Opps, I hadn't actually tried that code, but it looks like there is a syntax error in the second "$output .= " line, it should be


$output .= l(t(chr($i)), $path. t(chr($i)), $options) .'&nbsp;';

perfectsense’s picture

Yes, it's working. But this:

there is not a one to one correspondence between the Latin and Cyrillic character sets.

is too bad. (((
Thank you very much.
Sorry, can i ask you another question? Is there a way to place index with two rows of letters? like this:
ABCDEFGH......
АБВГДЕЖЗ.....

rjerome’s picture

I'll see if I can come up with a more elegant solution which includes all Cyrillic characters.

Did mean that you want to have both Latin and Cyrillic lines?

perfectsense’s picture

Yes, both Latin and Cyrillic lines. Thank you.

liam morland’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This version is no longer maintained. If this issue is still relevant to the Drupal 7 version, please re-open and provide details.