Rendering htmlbars templates to string


We have an application that is rendered in multiple languages. In our language string we sometimes have need of the link-to helper since we have strings like:

sign in to be able to participate, don’t have an account? Register now.

Where “sign in” and “register” are links to their respective routes in our app.

To do this we compile all our language strings to htmlbar templates and render these in the app where needed using a component where we set the layout/template dynamically.

But in some places in our app we need to get strings from code, for example to fill the options of a select tag. For this we would like to be able to render the htmlbar templates to a string. The reason for this is that we do not want two ways of defining translations: one time as htmlbar templates and another times as handlebars or just plain string replace/format.

this is an example of a json language file that later gets compiled:

    "T0007": "{{property}} is required",
    "T0008": "{{property}} should be at least {{count}} characters",
    "T0009": "{{property}} should not exceed {{count}} characters",
    "T0047": "{{#link-to 'sign-in'}}Sign in{{/link-to}} to participate. Don't have an account? {{#link-to 'register'}}Register{{/link-to}} now.",

I was able to render a htmlbars template to a string by creating a view in code, setting its template, setting the state of the view to inBuffer and then write my own renderTree method that uses a lot of private properties like _morph, _childViewsMorph, _childViews. The gist of it is that I copy pasted part of the ember source code to render templates.

To sum up:

Is there a way to render htmlbar templates to a string instead of the DOM? Or could this be added in a future version of htmlbars / ember?