Hello to everybody,
Some days ago I installed habari (v0.6 from the svn repository) in a
linux (fedora) machine that is configured with Spanish locale
("es_ES.UTF-8").
It was easy to install, and I used K2 theme. Then I started to
personalize it, basically to learn and to translate things into spanish
(later I found out that some hacks were unnecessary... :)
I was able to figure out how to make and use a spanish locale to
translate things like "and" (used in the "and_list()" function),
"previous", "next", etc. using poedit and creating a new "es_es" folder
under "/sytem/locale/". It worked well.
But then, I came into a big problem: month names won't translate at all,
they were in english and were not related to the "habari.mo" file. I'm
not a guru at php, but I digged deep into the code and found out that
date output was a theme config option that is driven by the "Format"
class that uses "nice_date()" formater function. I studied that function
and made it to use the "strftime()" php function (putting a format
string with %'s in theme's option), but it didn't work either.
so I looked at "strftime()" function in the docs
(http://www.php.net/strftime) and found out that a call to "setlocale()"
was needed for this function to work correctly. But the php
"setlocale()" function is NEVER CALLED AT ALL in the whole habari
system, so it never would work...
I decided to test it and hacked the "Locale" class to include in the
"::set" method a call to this "setlocale()" function, and suddenly
everything was working! "September" was "septiembre"!! :) (by the way,
why does this method lowercase the locale string??)
Yesterday I was talking to some people in the #habari channel at the IRC
commenting this problem, to see if this "thing" cand be "solved" in the
project, and now I write this e-mail to "leave things written", to
anyone who might find this problem like me and, maybe, finds this info
helpful.
I made a "solution" for this, with the objective o making it the less
invasive possible, as, if you update the app, everything still would
(hopefully) work:
1. edit your .htaccess file (in the root folder of your habari
installation) and include at the end of it this line:
php_value auto_prepend_file "lconfig.php"
2. create the "lconfig.php" (locale config) file in the root folder of
your habari installation and put this line on it:
<?php setlocale(LC_ALL, 'es_ES.UTF-8'); ?>
this hack basically makes a call to setlocale() when the application
starts. Remember to change the "es_ES.UTF-8" to your own locale identifier.
there are lots of ways to solve this, but my idea was to be
"app-independant", and remember, I'm not a php guru! :)
comments are welcome!
PD: we need spanish locale included in the habari release!! ;)
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/habari-dev
-~----------~----~----~----~------~----~------~--~---