Jump to content

Multilingual blog with multilingual date field


ksymmons
 Share

Recommended Posts

Hi,

I'm creating a multilingual blog for a client. I'm using Multi-language fields, and it's working great. Essentially, there are two versions of each article: one in English and one in Spanish. 

Now, I've created a Datetime field with a "Date/time picker" so that they can add a publication date (no time) to their blog entries. I want the month part of the date to be displayed in whatever language the article is being displayed in. Let's take the following example:

1) "Un artículo de ejemplo", accessible via example.com/un-articulo-de-ejemplo/
2) "A sample article", accessible via example.com/en/a-sample-article/

In this example, for article number 1 I want the date to be "12 ene 2017", and for article number 2 I want it to be "12 jan 2017". In other words, the same format for both languages, but localised. And for some reason, I seem unable to do so and dates are always displayed in English.

Here's the code I'm using to display the date field:

<?= $post->publication_date; ?>

How can I get this to work? Thanks.

date-conf-2.png

date-conf.png

editor.png

Link to comment
Share on other sites

  • 4 weeks later...

It turns out the culprit was that I misspelled the locale name in this translation file:

/wire/modules/LanguageSupport/LanguageSupport.module

Essentially, I had en_GB.UTF8 and es_ES.UTF8 instead of en_GB.UTF-and es_ES.UTF-8, that is , I forgot the hyphen.

I know it's quite silly, but I'm posting this here just in case someone else runs into a similar issue.

  • Like 3
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...