I have a field in a site I'm creating which is weather and uses a TABLE field in order to enter the MONTH, TEMP, RAIN etc etc. Im using 2 locales within the site, EN and FR...

Initially I've setup the default values for the MONTH to include JANUARY > DECEMBER which is great, i don't really want the client to have to re-enter this information each time. But is it then possible to set the DEFAULT french values for this field too?

Cant see to find a way around this...



It's not possible to have different defaults per locale with the Table field type. Also keep in mind that the content from the first locale you edit is copied over to all other locales on the first save.

But how about using numbers for the months in the table and to show the full month names in your templates get them from craft.i18n.getLocaleData:

{% for row in myTableField %}
        {{ craft.i18n.getLocaleData().getMonthName(row.col1) }}:
        {{ row.col2 }}
{% endfor %}

Another way would be to use the date filter:

{{ ('2015-' ~ row.col1 ~ '-1')|date('F') }}
  • Ah thats not a bad idea actually that... I'm still looking into how best to use fields to their best scenario, so this could be a good way to look at it.. thanks .
    – Etheya
    Aug 18 '15 at 14:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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