Welcome to Geeklog, Anonymous Friday, May 24 2024 @ 04:06 am EDT

Geeklog Forums

Change language on date


Status: offline

Cohin

Forum User
Newbie
Registered: 12/31/03
Posts: 14
Hello, I would like to ask you how to change the language on the date, now in English, in my Spanish page. I would like all dates, the top wellcome date, and the article dates to show in Spanish and I do not know how to change that. Thank you
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
You have to set the correct locale in config.php. For Spanish, try

$_CONF['locale'] = 'es_ES';

(assuming your site is running on a Unix-like system)

bye, Dirk
 Quote

Status: offline

Cohin

Forum User
Newbie
Registered: 12/31/03
Posts: 14
I actually had
$_CONF['language'] = 'spanish';
$_CONF['locale'] = 'es-ES';
and still shows in English rather than Spanish
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Try 'es_ES' (with an underscore).

It's also possible that your hosting service does not support Spanish (especially if it's cheap / free hosting or located in another country).

Btw, I just wrote an FAQ entry explaining the language and locale settings.

bye, Dirk
 Quote

Status: offline

Cohin

Forum User
Newbie
Registered: 12/31/03
Posts: 14
Looked at lots angles on this, my Unix server does allow Spanish and everything seams to be in order, yet my date is in English. I looked around the web at other Geeklog sites in Spanish, and everyone I saw has the dates in Englist. I will continue looking for a solution, once I find it I let you know.
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Try this little script:
Text Formatted Code
<?php

echo "<p>Today is " . strftime ("%A");

$result = setlocale (LC_ALL, 'es_ES');

if ($result === false) {
    echo "<p>An error occured when switching the locale.";
} else {
    echo "<p>Switched to locale " . $result;
    echo "<p>Today is " . strftime ("%A");
}

?>
 
If it produces an error message, try replacing "LC_ALL" with "LC_TIME" and see if that makes a difference.

bye, Dirk
 Quote

Status: offline

Cohin

Forum User
Newbie
Registered: 12/31/03
Posts: 14
It gives me
Today is Saturday

Switched to locale es_ES

Today is sábado

no error message.
My config.php is
$_CONF['language'] = 'spanish';
$_CONF['locale'] = 'es-ES';
$_CONF['date'] = '%A, %B %d %Y @ %I:%M %p %Z';
$_CONF['daytime'] = '%m/%d %I:%M%p';
$_CONF['shortdate'] = '%x';
$_CONF['dateonly'] = '%d-%b';
$_CONF['timeonly'] = '%I:%M %p %Z';
$_CONF['default_charset'] = 'es-ES.iso-8859-1';
$_CONF['rdf_language'] = 'es-ES'; // may have to be different than the locale

What am I doing wrong Dirk?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by Cohin: $_CONF['locale'] = 'es-ES';


As I said above, try 'es_ES' with an underscore - you have a dash (minus) there ...

bye, Dirk
 Quote

Status: offline

Cohin

Forum User
Newbie
Registered: 12/31/03
Posts: 14
Oops! solved! Tnank you for your patince.
 Quote

All times are EDT. The time is now 04:06 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content