I'm trying to translate the labels for a global checkbox field in my front-end templates like in this post: Is there a way to have checkbox field labels translatable?. This looked promising but I can't seem to get it working (maybe it's Craft2 and things have changed in 3)

Basically it's using namespacing in the translations file e.g for a French translation file

return [
  'field.fruits.option.apple.label' => 'pomme',
  'field.fruits.option.lemon.label' => 'citron',

But no translations showing in the template when I try

{% for fruit in myGlobalSet.fruits %}
    {{ fruit.label|t }}
{% endfor %} 

Any ideas? I'm sure it must be syntax related or wrong namespacing but I'm not getting any errors.

1 Answer 1


In order to do the namespaced trick in Craft 3, you'd do it like this:

Create your folder structure like this for your locale with one file for the Control Panel and one for the front-end of the site:

enter image description here

Contents of files:

enter image description here

Settings for Checkbox field:

enter image description here

Template code:

enter image description here

Front-end results:

enter image description here

Edit entry results:

enter image description here

  • Thanks Brad. I'm using static translations successfully elsewhere in the site but for my particular use case (slightly more complex than fruits) I'm wanting to drill down more specifically and translate only the checkbox field's labels based on their value. That's why the post I referenced was interesting. Is it at all possible to do it the namespacing way in Craft3? Commented Nov 28, 2018 at 20:31
  • Updated answer.
    – Brad Bell
    Commented Nov 30, 2018 at 23:52

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.