# TypeError: Discourse.Dialect.postProcessText is not a function

**URL:** https://meta.discourse.org/t/typeerror-discourse-dialect-postprocesstext-is-not-a-function/49963
**Category:** Development
**Created:** [September 10, 2016, 10:35am UTC](https://meta.discourse.org/t/typeerror-discourse-dialect-postprocesstext-is-not-a-function/49963 "2016-09-10T10:35:15Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [September 10, 2016, 11:33am UTC](https://meta.discourse.org/t/typeerror-discourse-dialect-postprocesstext-is-not-a-function/49963/2 "2016-09-10T11:33:07Z")

</div>

You should see a console message saying it is deprecated.

I haven’t tested this, but I think this is close to what you’d want.

Create a file at /assets/javascripts/lib/discourse-markdown/pirate-speak.js.es6

```plaintext
import { registerOption } from 'pretty-text/pretty-text';

registerOption((siteSettings, opts) => {
  opts.features['pirate-speak'] = true;
});

function piratize (text) {
  return text.replace(/\b(am|are|is)\b/ig, "be")
             .replace(/ing\b/ig, "in'")
             .replace(/v/ig, "'");
}

export function setup(helper) {
  helper.postProcessText(function (text) {
    text = [].concat(text);
    for (var i = 0; i < text.length; i++) {
      if (text[i].length > 0 && text[i][0] !== "<") {
        text[i] = piratize(text[i]);
      }
    }
    return text;
  });
}

```

I haven’t actually tested this, but it should at least put you on the right track.

You can find more about the dialect helper at  
[https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/engines/discourse-markdown.js.es6](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/pretty-text/engines/discourse-markdown.js.es6)

---

_[View the full topic](https://meta.discourse.org/t/typeerror-discourse-dialect-postprocesstext-is-not-a-function/49963)._
