I am using Impact theme with Internationalization. The author information that displays alongside content does not translate and remains in English even when the other language is selected. I have manually translated "posted on" using the Internationalization string translation facility but the dates already have the correct translations entered in the system for "Monday", "Tuesday", November", etc. Therefore it seems the theme is not picking up the date strings from the usual place. I have tried several other themes which all translate the authoring information on their own without any coaxing, so Internationalization is correctly configured, but I need to force this theme to use it.
I have posted an issue on the theme's project page but I need a fix for this urgently as the site is due to go live very soon and I absolutely cannot have the dates failing to translate. Please can anybody help?
Thank you.
Edit:
In the Impact theme's node.tpl.php this appears to be the code that inserts the date:
<?php if ($display_submitted): ?>
<span class="submitted">
<?php print t('Posted by') . ' ' . $name; ?> <?php print t('on') . ' ' . $date; ?>
</span>
<?php endif; ?>while in the Professional Responsive theme, which does translate the dates, it's done with:
<?php if ($display_submitted): ?>
<span class="submitted"><?php print $submitted; ?></span>
<?php endif; ?>Where do the variables $date and $submitted come from? Are they theme specific? Could I hack one to imitate the other?
Comments
Check your template.php in your current theme
$date or $submitted is provide by themename_preprocess_node(). In this function your can provide more variable:
ex: $variables['your_sumitted'] = date(......)
And then in your node.tpl.php you can print this: print $your_sumitted as well.
I hope this helpfull.
Thank you for the reply :)
Thank you for the reply :)
In my theme's template.php I have this:
So you're suggesting I add something in there such as
$variables['es_date'] = t('!datetime', array('!datetime' => date('l, j F Y', $variables['created'])));?How would I make that display in Spanish? I know the l, j F Y as the standard PHP date formatters but I don't know how to make them show in Spanish.
I have looked in the project translations for the theme, and in Spanish !datetime shows as not translated - which I'm guessing is the root of the problem.
SOLVED!
Oh you are brilliant, thank you! And I've just realised I really can call myself a hack :D
Rather than add an extra variable I removed the one that was there:
Then I edited the call to it in node.tpl.php accordingly and now it's defaulting to the system translations and it's actually translating the whole author info including the date automatically!!!
Thank you so much :)