add translate method for container to get transpiled code

when I use the transpiler as a library, I only want the result, not to write files.