# Quick translation for a few custom menu items?

**URL:** https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997
**Category:** Translations
**Created:** [4월 14, 2017, 4:34오후 UTC](https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997 "2017-04-14T16:34:00Z")
**Posts on this page:** 11
**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: [4월 14, 2017, 4:34오후 UTC](https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997/1 "2017-04-14T16:34:00Z")

</div>

When I add a custom menu item, say to the Hamburger menu, is there an easy way to provide translations for those items for a couple of locales?

I’d assume that this has come up before but I don’t seem to come up with the right search terms…

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [4월 14, 2017, 6:16오후 UTC](https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997/2 "2017-04-14T18:16:20Z")

</div>

How are you adding the custom menu item? Is it using our plugin api? If so there is probably a syntax I can share to help you do this.

---

<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: [4월 15, 2017, 7:48오전 UTC](https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997/3 "2017-04-15T07:48:20Z")

</div>

I am on phone-only these days and can’t seem to be able to copy code out of the theme editor 😕 to paste here, but I think the answer is yes, I’m using the api (`api.decorateWidget`).

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [4월 17, 2017, 3:58오후 UTC](https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997/4 "2017-04-17T15:58:20Z")

</div>

If you’re using `api.decorateWidget` you can call `I18n.t('some.key')` and it’ll be translated using our internal system.

Unfortunately that key will not show up in the admin \> customize \> text content because it doesn’t already exist.

Your best bet is to create a plugin to do this. Plugins can define new translations.

---

<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: [4월 17, 2017, 4:57오후 UTC](https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997/5 "2017-04-17T16:57:18Z")

</div>

Thanks for the advice. I’m afraid it’s a bit of an overkill to create a plugin to translate a couple of terms into a couple of languages.

Actually, maybe there is a misunderstanding? I am not looking for the actual translations (I can do those myself for the time being) but for a way of having these translated words displayed if a user has selected the respective locale.

---

<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: [4월 17, 2017, 5:03오후 UTC](https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997/6 "2017-04-17T17:03:08Z")

</div>

You would just have the following lines per language right?

```plaintext
  I18n.translations.en.js.filters.tags = { title: "Tags", help: "View all Tags" };
  I18n.translations.en.js.filters.unanswered = { title: "Unanswered", help: "View all Unanswered Topics" };

```

You would need to put in the correct paths, but the `en` would get replaced with each language variant.

---

<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: [6월 15, 2017, 11:25오후 UTC](https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997/7 "2017-06-15T23:25:34Z")

</div>

> [@cpradio](#):
>
> help: “View all Unanswered Topics” };
> 
> You would need to put in the correct paths

Could you explain a bit more? What would be an example of a “right path”?

---

<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: [6월 16, 2017, 12:05오전 UTC](https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997/8 "2017-06-16T00:05:08Z")

</div>

You would just copy the en version and replace “en” with the appropriate language identifier, such as, fa\_ir

---

<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: [6월 16, 2017, 5:42오전 UTC](https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997/9 "2017-06-16T05:42:07Z")

</div>

Okay, then my question is rather, where do I find this code:

> [@cpradio](#):
>
> I18n.translations.en.js.filters.tags = { title: “Tags”, help: “View all Tags” };  
> I18n.translations.en.js.filters.unanswered = { title: “Unanswered”, help: “View all Unanswered Topics” };

---

<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: [6월 16, 2017, 11:32오전 UTC](https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997/10 "2017-06-16T11:32:30Z")

</div>

In the custom JavaScript you used to create the hamburger menu item? … What code did you use to add items to the Hamburger Menu? (that may be the better question here)

---

<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: [6월 17, 2017, 9:57오전 UTC](https://meta.discourse.org/t/quick-translation-for-a-few-custom-menu-items/60997/11 "2017-06-17T09:57:56Z")

</div>

This:

[https://meta.discourse.org/t/how-to-edit-hamburger-menu-items/22167/11?u=tophee](https://meta.discourse.org/t/how-to-edit-hamburger-menu-items/22167/11)
