MyBB Community Forums

Full Version: Translate function
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a docs page somewhere that lists all the built-in functions we can use when writing a plugin?

That would help me generally in the future.

Specifically, on this occasion I'm looking for a function I can run a string through in order to expand out any <lang:foo> placeholders into their translated content. (I use Drupal a lot, and I'm new to MyBB - but any other Drupal users reading this will know what I mean when I say I'm looking for the equivalent of t() function).
There's not really a list of functions as such as it's basically anything in MyBB, you can use anything - when you say translations though, do you mean translating user generated text, or static text for use in templates? Static text would make use of the language files, where you'd load a file and use $lang->string_name to display it (and it would load the language file for the user's language), but translating user generated content would require a custom system as it's not something supported in core.
Thanks, Matt

I've found what I was after for the case I was working on.

I was trying to updated the Report to Thread plugin for 1.8.x - it mostly just needed the compatability value bumping, but it also failed because the report reason is now an integer ID. So I needed to look up the "title" of that report reason ID in the database.


        $lang->load('report');
        $report_reason = $lang->parse($reason['title']);


does the trick - copied from inc/functions_modcp.php where the email report is formed up.