Translating a section's title field on save For a Single section's entry type that has the title field hidden, I'd like to translate the generated title, as per the entry's locale.

I've currently got the following in the entry type's "Title Format" field:

{section.name|t(language=locale)}


However, this doesn't translate the section.name as per the entry's locale, it appears to use the current CP locale instead (i.e., if the CP is currently rendered in English, it'll use the English translation for entries in all locales). However, if I use something like

{section.name|t(language=locale)} ({locale})


the latter locale value (inside the parenthesis) does reflect the entry's locale (it'll print something like Section Name (no) for the Norwegian version. So that's a bit odd.

Also, I've tested with a hard coded string for the t filter's language parameter (i.e. {section.name|t(language="no")}), which works as expected.

Not sure what's going on – though I'm guessing that the locale variable passed to the translation filter is somehow null (in which case Craft will use the current locale). How can I translate an entry type's Title Format based on the entry's locale?
Figured out something that works, though I can't explain why:

{{ object.section.name|t(language=object.locale) }}


Update

Here's how to do it for Craft 3:

{{ object.section.name|t('site', language=object.site.language) }}