WordPress.org

Ready to get started?Download WordPress

Forums

Spanish date format (2 posts)

  1. ralphyw
    Member
    Posted 6 years ago #

    I'm using WordPress 2.3.1 in the original English for a site in Spanish and want to format dates in the Spanish format, that is to say, the date of this post is 9 de diciembre de 2007.
    Note the de before the month and the year, and the month name in lower case.
    I've tried:
    <?php setlocale(LC_TIME, "es_ES"); ?><?php echo strftime("%d de %B de %Y"); ?>
    but this renders:
    09 de December de 2007
    with the month name in English.
    My WordPress runs on Ubuntu 7.04, PHP 5.2.1.

    Also, in wp-config.php, I have:
    define ('WPLANG', 'es_ES');

    but this doesn't seem to have any effect on the app, everything appears in English in the Admin panel. This is no problem, I mention it in case it has any bearing on the date format issue.

    Any help appreciated.

  2. moshu
    Member
    Posted 6 years ago #

    If you define WPLANG in the config file - you also need to have the proper .mo file installed. However, that still would trsnalte only the backend (admin) and not the front-end = i.e. the theme.
    Themes need their own localization (.mo file).
    As for the date: you need to edit the_dtae or the_time tag in your theme file(s) and use the proper parameters there.

    If you don't want to translate the wholoe theme... then just edit the wp-includes/locale.php and translate the months names + edit the tags as said above.

Topic Closed

This topic has been closed to new replies.

About this Topic