I'm new to this fantastic CMS. Right now I'm working on a new project completely based on GP Easy (this will be my first but not last project whith this tool!).
But, as i'm not a good programmer (just CSS "coinosceur") and graphic designer, i can't figure out how can I translate the dates on the module Blog Made Easy 1, to Spanish.
My client wants to read "Lunes" instead of monday, or "Julio" instead of "July"…
I've read about PHP date function on Spanish and i found this, in order to force PHP to show the spanish date format:
echo strftime("%A %d de %B del %Y");
But i can´t figure out where to insert the firt line of code in order to translate the dates…any idea?
Thanks in advance!!!
You can change the date format without modifying the php by changing the 'Date Format' option in the blog configuration.
The url for the configuration is __your_installation__/Special_Blog?cmd=config or you can click on the "Configuration" link under the "Current Page" heading in the admin toolbar (it will only show up there when you're on a blog page).
Thanks for your anwser. But, I'm afraid that the problem is not the date configuration on the GP Easy Blog module.
As far as I know there are several ways of printing the date format, and I understand the configuration tool.
The date is shown on the default language of the server. I can't access the config.php on my hosting provider to change language settings, so, there must be a way of creating an array with the names of the months and each day of the week in order to show the spanish date language, not format.
This is an example code of the arrays we'd create to show the spanish date:
$ano = date('Y',$FechaStamp);
$mes = date('n',$FechaStamp);
$dia = date('d',$FechaStamp);
$diasemana = date('w',$FechaStamp);
return $diassemanaN[$diasemana].", $dia de ". $mesesN[$mes] ." de $ano";
So i could get " Viernes, 8 de Julio, 2011" instead of "Friday, 8 July 2011"
Hello, you can open the SimpleBlog.php and SimpleBlogCommon.php in text editor and do a search for this string: ['date_format']
and then replace the found lines with your function call. So it are these 3 lines:
433 echo $this->SpanishDate($post['time']);
628 echo $this->SpanishDate($comment['time']);
559 echo $this->SpanishDate($post['time']);
and then also copy+paste your function into SimpleBlogCommon.php's class. It should work then. Don't forget to save it as utf-8.
By the way;
I've followed upo the instructions in order to adapt to the spanish date scriptthe Plugin Simple Blog 1, and it also works (awesome, being me the one who made the mods!!).
And know, one step further: let's suppose that i'm trying to make a multilingual web site.
By the moment the way i'm doing it is by crating a menu tree in wich the first levels are occupied only by the language links, and all the sub links are the contents in each language.
Is there any way of making the blog show the date in the desired language?
Hi Pepe, yes it is possible, but it takes much more time and effort than the previous example.
At first, you should have two layouts - one for Spanish pages and one for English pages. Assign each english page the alternative layout.
Then you should create some custom menu for english layout. Then insert Blog (Special page) to the menu as an "External link" and set: /index.php/Blog?lang=es
Then you should modify again the source code of blog, to be able to handle this new url-parameter:
433 echo ($this->blogData['lang']=='es')? $this->SpanishDate($post['time']):date($this->blogData['date_format'],$post['time']);
628 echo ($this->blogData['lang']=='es')? $this->SpanishDate($comment['time']):date($this->blogData['date_format'],$comment['time']);
& insert the line #21: parse_str($_SERVER['QUERY_STRING']); $this->blogData['lang'] = isset($lang)? $lang:'en';
559 echo ($this->blogData['lang']=='es')? $this->SpanishDate($post['time']):date($blog_config['date_format'],$post['time']);
+again attach to the script the SpanishDate() function...
and then you should search for common::link function call (inside both .php files) and append to her each 3rd parameter this string: .'&lang=' .$this->blogData['lang'] ,
respectively only 'lang=' .$this->blogData['lang'] ,if none specified. Then save and it should work... Have a nice day :-)
A new release for Typesetter is in the works with a lot of improvements including the ... Read MoreTypesetter 5.1
Typesetter 5.1 is now available for download. 5.1 includes bug fixes, UI/UX improvements, ... Read MoreMore News
What CMS: Find out what CMS a site is using.
Who Hosts This: Find out who is hosting any web site
WordPress Theme Detect: Find out which theme a WordPress site is using