Drupal Hebrew site tips

Hagay Mandel
CERTIFIED EXPERT
Published:
RTL (right to left) web applications aiming for audiences speaking languages like Hebrew or Arabic, are generally more complicated than the same applications aiming for audiences speaking Latin based languages.

The main difference lies of course in the writing direction of these languages, and usually, web applications and several development environments, are capable of solving the directional issue with reasonable results.

Another difficulty in web applications is the encoding issue which affects several issues in a application:
Sure, presenting site's pages in the right encoding is not much of an issue, and the right html declaration will do the trick, but what about the back side of the site - the MySQL database?

Drupal is no different, it was Hebraized by an Israeli team, and it generally functions well.
However, several issues are not well solved or were put aside, small annoying issues, that prevent building a complete Hebrew based Drupal site,
This article will provide possible solutions to 2 of these annoying issues.

We'll start with the installation:
Drupal's installation script is excellent, and it does everything for you, except for the creation of the MySQL database of the server. Prior to the installation process.
You need to generate a new database which will be filled with content by Drupal automatically.
Well here is the first issue: selecting the right collation; failing doing so, will not harm the Drupal application, or prevent it from functioning, however, when the site operator / administrator will look at the MySQL tables (through a management tool such as phpMyAdmin), the content of all MySQL tables, will be a collection of question marks or complete Gibberish.
The solution is to select the 'utf8_general_ci’ collation on the database creation, this will cause all MySQL tables to display correct Hebrew content.
(see illustration below).

The second issue relates to Hebrew names of uploaded files:
When a user uploads a file (for example an image file) that has a Hebrew file name, the upload process changes the Hebrew characters to Latin ones.
When the image file is later on displayed on a page, or when the operator/administrator checks the files directory, all files carry Gibberish instead of Hebrew names.

A possible solution would be using the Transliteration module (http://drupal.org/project/transliteration).
This module replaces non Latin characters with equivalent Latin ones based on a replacement international convention.
This solves the Gibberish issue, but still files names lack significance!

My solution is a comprehensive one, and allows maintaining the actual Hebrew names!
The solution is to make a change in Drupal’s unicode.inc file (located in the ‘includes’ directory):
At line #42 (in Drupal 6.20) you’ll find:
// Set the standard C locale to ensure consistent, ASCII-only string handling.
                        setlocale(LC_CTYPE, 'C');

Open in new window


This should be replaced by:
[
setlocale(LC_CTYPE, 'he_IL.UTF-8');

Open in new window

This can be changed to any RTL language!
   
collation.jpg
1
3,875 Views
Hagay Mandel
CERTIFIED EXPERT

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.