# Trouble getting multilingual content

**URL:** <https://community.prismic.io/t/trouble-getting-multilingual-content/1067>\
**Category:** Developing with Prismic\
**Tags:** javascript\
**Created:** [June 30, 2020, 8:25pm UTC](https://community.prismic.io/t/trouble-getting-multilingual-content/1067 "2020-06-30T20:25:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tutanck](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/tutanck/32/503_2.png) [@tutanck](https://community.prismic.io/u/tutanck)\
**Post date:** [June 30, 2020, 8:25pm UTC](https://community.prismic.io/t/trouble-getting-multilingual-content/1067/1 "2020-06-30T20:25:59Z")

</div>

Hi everyone !  
I have some trouble when i try to fetch documents in locales that are different from the main "language (fr-fr)".

- When i fetch a document by id (id of the document in the main language) with the option {lang: \*} , in the "alternate\_languages" key in the result, i can find information like id, lang, uid, type, but there is no data.
- When if then fetch the document in another language than the main language (using its id, or its uid), i have no results (empty array)  
Here is my repository : [https://eggs.prismic.io/api](https://eggs.prismic.io/api)  
even when i search for all documents in the api i dont find any document in other languages.  
but everything seems to be ok in my repository. document are published and marked as live.  
Please, can you help ?  
Thank in advance.

---

<div class="post-metadata">

**Author:** ![Levi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/levi/32/24_2.png) [@Levi](https://community.prismic.io/u/Levi)\
**Post date:** [July 1, 2020, 8:37am UTC](https://community.prismic.io/t/trouble-getting-multilingual-content/1067/2 "2020-07-01T08:37:25Z")

</div>

Hi @tutanck, hopefully we can sort this out for you 🙂

1. When you query a document, the `alternate_languages` array will only contain the meta data for the documents (ID, lang, UID, etc.). So it’s normal that there is no data there.

2. Can you show me the query you are running when you don’t get any results? You might need to put the asterisk in quotes: `{ lang: '*' }`

---

<div class="post-metadata">

**Author:** ![tutanck](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/tutanck/32/503_2.png) [@tutanck](https://community.prismic.io/u/tutanck)\
**Post date:** [July 1, 2020, 12:04pm UTC](https://community.prismic.io/t/trouble-getting-multilingual-content/1067/3 "2020-07-01T12:04:20Z")

</div>

Hi. okay. I understand but there is still a problem. I don’t have any result when i fetch by id (of the document written in a locale) .  
My App is a simple translation app.  
Here is an extract of my “prismic-toolbox.js” file with a custom method to fetch a “_phrase’s translation infos (metadata)_” : **[getPhraseTranslationInfosByLang](https://jsfiddle.net/dbmkcgou/).** and a method to fetch a phrase : **[getPhrase](https://jsfiddle.net/xw7L4mod/)**.

And here is my  
[fetchTranslation](https://jsfiddle.net/t90obxph/) method that call **getPhraseTranslationInfosByLang** and then try to fetch the ‘translated’ phrase by its id (with **getPhrase** ).  
When i fetch a ‘translated’ phrase by its id i get an empty result array.  
Even when i just call directly getPhrase(“XvtsRBUAACgAb6Sp”) where “XvtsRBUAACgAb6Sp” is the id of a ‘phrase document’ in the local ‘en-us’ i have no results. But when i call getPhrase with the id of the french version (fr-fr) of the same document, everything work well.

You will find a sreenshot attached.

Thanks a lot for your help.

 ![Capture d’écran 2020-07-01 à 13.59.53](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/1X/06c6005e11248c09d15b4cb50e56dc41ebbebf3e.png)

---

<div class="post-metadata">

**Author:** ![Levi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/levi/32/24_2.png) [@Levi](https://community.prismic.io/u/Levi)\
**Post date:** [July 1, 2020, 12:15pm UTC](https://community.prismic.io/t/trouble-getting-multilingual-content/1067/4 "2020-07-01T12:15:09Z")

</div>

I took a look and think I know what the issue is here. Even when you query by ID like this, you need to specify the language code or the wildcard `'*'`. If you don’t specify a lang, then the API will always assume that you’re querying for documents in the main language. This is why it works for your `fr-fr` document but not your `en-us` one.

I think all you need to do to make this work is to add the `{ lang: '*' }` query option to this query and it will work as you expect.

---

<div class="post-metadata">

**Author:** ![tutanck](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/tutanck/32/503_2.png) [@tutanck](https://community.prismic.io/u/tutanck)\
**Post date:** [July 1, 2020, 12:18pm UTC](https://community.prismic.io/t/trouble-getting-multilingual-content/1067/5 "2020-07-01T12:18:52Z")

</div>

> [@Levi](#):
>
> `{ lang: '*' }`

Thank you very much 🙏 🙏 🙏 it works just fine !  
i thought that by default prismic would assume a defaul value of `{ lang: '*' }`

---

<div class="post-metadata">

**Author:** ![Levi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/levi/32/24_2.png) [@Levi](https://community.prismic.io/u/Levi)\
**Post date:** [July 1, 2020, 12:21pm UTC](https://community.prismic.io/t/trouble-getting-multilingual-content/1067/6 "2020-07-01T12:21:44Z")

</div>

Yeah, it might not be obvious but if you don’t specify a language, then Prismic queries the main language by default.

I’m happy that we were able to sort it out for you 🙂

---

<div class="post-metadata">

**Author:** ![Phil](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/phil/32/14_2.png) [@Phil](https://community.prismic.io/u/Phil)\
**Post date:** [September 15, 2020, 4:46pm UTC](https://community.prismic.io/t/trouble-getting-multilingual-content/1067/7 "2020-09-15T16:46:16Z")

</div>



---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 5:33pm UTC](https://community.prismic.io/t/trouble-getting-multilingual-content/1067/8 "2021-12-09T17:33:32Z")

</div>


