Open yauzi opened 11 years ago
You can do this by creating a file in your theme in lib/views/public_body/_alphabet.html.erb. If this file exists, it will override the existing app/views/public_body/_alphabet.html.erb template. Example content could be something like:
<%- "\u05D0".upto("\u05EA") do |l| -%>
<%= link_to_unless (@tag == l), l, list_public_bodies_path(:tag => l.downcase) %>
<% end %>
If you want to keep English as a language option, then the file for Hebrew needs to be in the theme as lib/views/public_body/_alphabet.he-IL.html.erb instead.
Having looked at this a bit more today, I think getting the links to produce the right lists of public bodies for the two languages may depend on getting a core alaveteli issue resolved: https://github.com/mysociety/alaveteli/issues/1000
@crowbot thanks. I'll be watching mysociety#1000 and check again once it's resolved and merged into our fork.
This made me think about the problem of how to generate the correct alphabet links automatically based on the locale. I think this probably isn't worth it, given that, as @crowbot explains above, overriding the alphabet list is easy to do in a theme, but, for the record, it could be done using data from the Unicode Common Locale Data Repository, which includes data on "index characters" for a locale:
For example, the exemplarCharacters
element for Hebrew is here:
http://unicode.org/cldr/trac/browser/tags/release-23-1/common/main/he.xml#L1111
Creating a gem that made that data easily accessible for Rails applications might be useful to the world at large, but perhaps not a good use of development time on Alaveteli at the moment.
We need to have the Hebrew alphabet available on the side panel at the authorities page.