This issue is splitted from the RTL API decisions on the the general core language direction (RTL) support discussion.
To summerize the above thread:
Currently, anyone who needs to know the language direction must hardcode it.
It was decided that locale.module should information about the language direction.
After dries review, it was decided to add the language direction information to the database - I've opened an issue for saving the information in the locales_meta table, suggesting that such information will be stored in a new properties field.
The previous suggested function was :
function locale_get_direction ($locale) {
$result = db_query("SELECT direction from {locales_meta} where locale='%lid' ", $locale);
if ($row = db_fetch_object($result)) {
return $row->direction;
}
else return FALSE;
}
Now, if we are using a properties field, we should fetch the 'direction' property from the field, so the code should be a little different - I don't know how to do it, but it should be something like that:
function locale_get_direction ($locale) {
$result = db_query("SELECT data from {locales_meta} where locale='%lid' ", $locale);
if ($row = db_fetch_object($result)) {
$direction = @get_direction_information ($row->data); /* How to get the property? */
return $direction;
}
else return FALSE;
}
Please commit!
Comments
Comment #1
druvision commentedOn a second thought, after reading Budapest internationalization meeting findings, I would stay with the 'direction' field since it's easier for module writers to use without needing a special conversion function
Comment #2
gábor hojtsyWe have a big patch coming up in the next days, which migrates the "locales_meta" table to a "language" table, which would also contain direction information among other things.
Comment #3
gábor hojtsyDrupal 6.x-dev now has support for directions, the global $language objects has a direction property, which can be used throughout the page building process. We put the $language detection as early as possible, so as many components can build on it as required.