Custom function inside menu defined in ui file

I’m trying to use different translation system than gnome is used to. Problem arose when I’ve tried to use it inside Ui files. I’ve created custom utility function translate :: str → str, but it seem not to work inside menus:

<object class="GtkMenuButton">
  <property name="menu_model">
    <menu>
      <section>
        <item>
          <attribute name="label">
            <closure function="translate">
               some name
            </closure>
          </attribute>
        </item>
      </section>
     </menu>
  </property>
</object>

this prints

Gtk-CRITICAL **: 13:30:49.720: Error building template class 'MyGtkAppWindow' for an instance of type 'MyGtkAppWindow': Element <closure> not allowed inside <attribute>

and I have no other ideas. How do I do it?