Wondering if there is a way to use transcribe add on for expression engine in another add on.

So ideally I would want to use the command that I would use in a template {exp:transcribe:replace name="variable"} in a library page of a custom add on that I developed.

The reason is I am building a single page app that gets all of it's content from ajax calls. So the page will call an add on I built that does the api call and returns the content in json format. Ideally I would make the translation in that add on so it is already translated once the json is returned to the page. From there Handlebars is building the page with the json object.

I am hoping there is a fairly straight forward way of doing this as I am fairly new to expression engine.

My alternative plan is to make a call and grab all variables for a given language and create an object or array out of it and then cycle through it when I need to translate something. This is not ideally how I would want to do it though as it feels like a hack.

1 Answer 1


Yep, shouldn't be a problem. You'll need to load the class:

if ( !class_exists('transcribe') ) {
    require_once PATH_THIRD.'transcribe/mod.transcribe'.EXT;
$transcribe = new Transcribe;

You can then call the public functions from that class:


But I don't have access to Transcribe source to go much further in explanation. The challenge you'll have is that the replace tag requires a parameter (name).

If you were using a template tag that matches the same parameter names, it should just work and the transcribe method will pull the parameters from your template tag. But because you're calling via Ajax, I'm assuming your end point is to the module itself, not another template - so this won't help.

When I build add-on methods I always allow them to be called as functions, allowing the tag parameters to be passed as method parameters. Without seeing the Transcribe method, I can't confirm how flexible the developer has coded it, but ideally this could work:


You might also find that the developer calls additional functions from their replace method and so instead you can call them directly, although they could be private. You may also be able to tap directly to the database functions.

If (worst case) the only way to get the value pairs into the method is via tag parameters, you could try manipulating the tag data, so that you've placed the parameter there already - so manipulating the ee()->TMPL->tagdata data. Their replace function will access it thinking it's come from a normal template tag parse.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.