Project:Bibliography Module
Version:6.x-1.7
Component:User interface
Category:support request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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

Comments

#1

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.

#2

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 ?

#3

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.

#4

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.

#5

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;';

#6

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......
АБВГДЕЖЗ.....

#7

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?

#8

Yes, both Latin and Cyrillic lines. Thank you.

nobody click here