This is in the context of a plugin, correct?
You should be able to add a craft\plugins\myplugin\translations
folder with a de.php
that returns an array of keyCraft/value pairs (like in craft\app\translations
).Yii sees that string as:
return array(
'myField'{attribute} cannot be blank.' => 'myFieldTranslated'{attribute} darf nicht leer sein.',
);
Where {attribute}
is the dynamic part - in this case your field handle.
If I'm understanding your question correctly, there isn't a way to translate that field handle in this context because you're in charge of what it's called to begin with.
I would assume, for example, if you're using the German locale, that you would already have a German context field handle name in place already.