Odd error message when editing field settings (Variable "targetLocaleFieldHtml" does not exist) After upgrading a site from 2.4.x to 2.6.x, I'm experiencing an odd issue where Craft throws the following template error whenever I attempt to edit a field:

Variable "targetLocaleFieldHtml" does not exist

The error message only displays if devMode is set to true, occurs for all fields and fieldtypes (also when attempting to create a new field), and prevents me from actually editing field settings (unless I turn off devMode).

Here's the full stack trace:

Template Error

Variable "targetLocaleFieldHtml" does not exist

/somepath/craft/app/templates/_components/fieldtypes/elementfieldsettings.html(33)

21                     options: sources,
22                     value: settings.source
23                 }) }}
24             {% endif %}
25         {% else %}
26             {{ forms.field({
27                 label: (allowMultipleSources ? "Sources"|t : "Source"|t)
28             }, '&lt;p class="error"&gt;' ~ "No sources exist yet."|t ~ '&lt;/p&gt;') }}
29         {% endif %}
30     {% endblock %}
31 
32     {% block targetLocaleField %}
33         {{ targetLocaleFieldHtml|raw }}
34     {% endblock %}
35 
36     {% block limitField %}
37         {% if allowLimit %}
38             {{ forms.textField({
39                 label: "Limit"|t,
40                 instructions: "Limit the number of selectable {type}."|t({ type: type|lower }),
41                 id: 'limit',
42                 name: 'limit',
43                 value: settings.limit,
44                 size: 2,
45                 errors: settings.getErrors('limit')
2016-06-06 18:44:40 Apache / Craft 2.6.2789
This had me stumped for a while, but it turned out to be a custom fieldtype extending BaseElementFieldType, in which the settings attribute targetLocaleField apparently was renamed targetLocaleFieldHtml with Craft 2.5.2750.

Not sure why the error was thrown for all fields and fieldtypes (even PlainText fields), but in any case the fix was simply replacing the targetLocaleField attribute with targetLocaleFieldHtml in the returned array for the getSettingsHtml() method in the custom fieldtype.

Edit: It just occurred to me that the reason for getting the error on all fields/fieldtypes is – of course – due to Craft actually pre-rendering the settings templates for all fieldtypes, I assume to make changing the fieldtype (via the dropdown) seamless/instantaneous.