# Discourse.Dialect 未定义错误

**URL:** https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126
**Category:** Support
**Created:** [2017年七月13日 11:22 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126 "2017-07-13T11:22:50Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年七月13日 11:22 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/1 "2017-07-13T11:22:50Z")

</div>

Could someone help me make sense of this error that I’m seeing in my logs?

```
Discourse.Dialect is undefined

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2017年七月13日 11:30 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/2 "2017-07-13T11:30:55Z")

</div>

Yeah it is ancient code we removed, upgrade all plugins, if it persists, remove one by one till it’s gone and report back with the culprit

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年七月13日 11:38 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/3 "2017-07-13T11:38:40Z")

</div>

Is it possible that a plugin is causing this error even when it is disabled (i.e. it’s still in the `app. yml` but not activated in site settings)? If so, everything seems to point to the abbreviations and acronyms plugin:

> [@Abbreviations and acronyms plugin](https://meta.discourse.org/t/abbreviations-and-acronyms-plugin/38501/43):
>
> Looks like a similar issue (involving Discourse.dialect\_deprecated) to what I had with the discourse-solved plugin - @eviltrout fixed it with this commit So probably a similar solution required here.

The author has not been seen since months and is not responding to various bug reports. Maybe the plugin should be tagged as broken?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2017年七月13日 11:39 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/4 "2017-07-13T11:39:58Z")

</div>

Yes absolutely will mark it now

Plugin needs to be removed and app rebuilt

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年七月13日 11:51 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/5 "2017-07-13T11:51:53Z")

</div>

> [@sam](#):
>
> Plugin needs to be removed and app rebuilt

So is this true for plugins in general: they can cause errors even when deactivated?

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2017年七月13日 12:03 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/6 "2017-07-13T12:03:22Z")

</div>

Yes, it is up to plugins to respect the “disabled” setting in their own programming - their javascript and ruby code is still loaded regardless. Some somewhat relavent discussion:

> [@Reporting which plugin has caused the error](https://meta.discourse.org/t/reporting-which-plugin-has-caused-the-error/65925):
>
> based on the errors I get in the admin panel, I feel discourse can understand which plugin has caused the error. look at these errors e.g. Uncaught TypeError: Cannot read property 'inlineBetween' of undefined Url: https://padpors.com/assets/plugin-third-party-66034ae1bc6977c5ec45dcf7adb5f8f9799ab0ff261ffd958c9425a34a956605.js Line: 1 Col or this one: TypeError: Discourse.Dialect is undefined Url: https://padpors.com/assets/plugin-third-party-66034ae1bc6977c5ec45dcf7adb5f8f9799ab0ff261ffd958…

> [@Reporting which plugin has caused the error](https://meta.discourse.org/t/reporting-which-plugin-has-caused-the-error/65925/2):
>
> This would be great. As a possibly related thing, it would be nice if one plugin throwing a JS exception didn’t break other plugins. I don’t know enough about how plugins are loaded to know whether that would be feasible though…

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年七月13日 13:33 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/7 "2017-07-13T13:33:22Z")

</div>

> [@david](#):
>
> it is up to plugins to respect the “disabled” setting in their own programming

Okay, I read that as: it depends how the plugin is programmed, so that it is possible to program it so that it has no effect whatsoever when it is disabled. I think that is a valuable design specification for anyone sponsoring or buying a plugin: make it so that it can be fully disabled. (Can spare some headaches for many people.)

---

<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: [2017年七月13日 13:35 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/8 "2017-07-13T13:35:39Z")

</div>

> [@tophee](#):
>
> so that it is possible to program it so that it has no effect whatsoever when it is disabled.

I’m not 100% sure that is true. Because some items get loaded automagically and just referencing a library that no longer exists will cause it to break, and that is before your setting check can even be invoked.

There are “ways” around that though, but to say it can be 100% disabled and not cause an issue, I think is bordering on impracticality.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2017年七月13日 13:38 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/9 "2017-07-13T13:38:36Z")

</div>

> [@tophee](#):
>
> it has no effect whatsoever when it is disabled

Yeah, ideally that would be the case. Sadly it’s not entirely realistic, especially for things like broken imports.

(e.g. when `discourse/lib/ajax` was moved last year)

Edit: @cpradio beat me to it

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2017年七月13日 13:53 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/10 "2017-07-13T13:53:23Z")

</div>

Yeah if we wanted easy peasy 100% robust disable

1. Core would have to be able to issue a “restart” to all the services it is running
2. Core would have to split up every plugin to have its own js file and have one js include per plugin (which may be desirable anyway cause it helps debugging a lot)

(1) is surprisingly difficult.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年七月14日 23:35 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/11 "2017-07-14T23:35:51Z")

</div>

> [@tophee](#):
>
> everything seems to point to the abbreviations and acronyms plugin:

To be fair, removing the acronyms and abbreviation did not stop those errors from occurring. So this plugin was either not causing any of them or it was not the only one doing so. Next try will be the [affiliate plugin](https://meta.discourse.org/t/discourse-affiliate-insert-affiliate-code-amazon-automatically-to-links/19585/39).

---

<div class="post-metadata">

### Author: ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)
#### Post date: [2017年七月15日 02:07 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/12 "2017-07-15T02:07:32Z")

</div>

I can confirm that the affiliate plugin causes this error when core is upgraded but not the plugin. I dealt with this exact error earlier today. Updating the affiliate plugin solved it.

---

<div class="post-metadata">

### Author: ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)
#### Post date: [2017年七月15日 08:40 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/13 "2017-07-15T08:40:13Z")

</div>

Hm, I did a complete rebuild so everything is up to date, but I’m still seeing this error

```
TypeError: Cannot read property 'addPreProcessor' of undefined

```

So if you’re saying that you are errorless with the plugin, I guess I’ll have to look elsewhere.

Edit: I just realized that this is a different error than the one I originally posted 🙄

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [2024年六月8日 12:44 UTC](https://meta.discourse.org/t/discourse-dialect-is-undefined-error/66126/14 "2024-06-08T12:44:28Z")

</div>

此主题已在 2522 天后自动关闭。不再允许回复。
