0

Working on multilingual site, I want to change the language of the month in dutch language. For that I have created a module.

<?php
function mymodule_format_date($timestamp, $type = 'custom', $format = 'd M', $timezone = NULL) {
  return format_date($timestamp, $type, $format, $timezone, 'nl');
}

and on the node file put the date format in t() function

<?php print t(format_date($created, 'custom', 'd M')); ?>

but no luck. Please help.

1 Answer 1

0

For multilingual you need to import .po file in your setup. Download .po file from this link just add language prefix at here language_prefix (/en, /hi, /de etc..).

https://localize.drupal.org/translate/languages/language_prefix

Now, add <?php print date('j F Y', $created) ?> simple php data function and add your data formate here.

After you will able to see day and month in your language.

If you wish to make a different format for both language just add this.

<?php if($language->language == "language_prefix") { print date('j F Y', $created); } else { print date('F j Y', $created); } Thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.