• in my wp-config.php file I’ve defined my language as follows:

    define('WPLANG', 'fr_FR');

    As other sites have suggested, I’ve updated the /wp-includes/locale.php file to replace all right-side values with the equivalent french values (for days of the week, months of the year, etc.)

    I’m still stuck with english dates when I call the_time() in my single.php template file, I don’t know what I’m missing. I’ve also included a fr_FR.mo file in my WordPress in hopes this might magically help.

    Am I missing something? I’ve also checked the locale in my template file using get_locale and it’s correctly returning fr_FR.

Viewing 5 replies - 1 through 5 (of 5 total)
  • I guess you need to wrap it in the GetText echo call _e()

    See How to localize WordPress themes and plugins with GetText

    Thread Starter Paat

    (@paat)

    But given a full date or time returned by the_time (or in this case, get_the_time), you couldn’t possibly register all possible dates and time for it to be translated by _e().

    _e() and __e() are used when it’s static strings, where you can register those string confident that they won’t change very often (such as every day, etc.)

    I’m fairly certain that the_time() has a localization engine contained within itself, or so the other websites seem to suggest…

    I’ve updated the /wp-includes/locale.php file to replace all right-side values with the equivalent french values (for days of the week, months of the year, etc.)

    The rule of thumb is never to alter a WP core.
    Besides, I translated a site four years ago and I updated WordPress many times ever since, meaning /wp-includes was overwritten with a new version during each WordPress update.

    In other words, I never bothered myself playing with locale.php and I won’t recommend to do that.

    In your particular case, I would guess that you missed fr_FR.po file.

    Thread Starter Paat

    (@paat)

    The rule of thumb is never to alter a WP core.
    Besides, I translated a site four years ago and I updated WordPress many times ever since, meaning /wp-includes was overwritten with a new version during each WordPress update.

    I think you hit it right on as to why you shouldn’t alter the core. It wrecks the maintainability and evolutivity of the installation, since you can no longer update it without losing what new code you’ve introduced.

    In my case, I know that the scope of this website is no longer than a year to 2 years and WordPress won’t be updated in the interim.

    More to the point…
    I thought that the .po file was only used to generate the .mo file, does WordPress use the .po file directly?

    Guess what? You are right. I just temporarily removed .po file, it didn’t change anything.

    Make sure you put your .mo file inside /wp-content/languages folder.

    If it still isn’t working, place .po file there, just in case. May be WP needs it for the first time when initiating localization.

    Good luck.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Translating the_date() and the_time() in french’ is closed to new replies.