# Error when changing default language

**URL:** <https://pdfjs.community/t/error-when-changing-default-language/1499>\
**Category:** Technical Support\
**Created:** [March 25, 2022, 9:54am UTC](https://pdfjs.community/t/error-when-changing-default-language/1499 "2022-03-25T09:54:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodolphe](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@rodolphe](https://pdfjs.community/u/rodolphe)\
**Post date:** [March 25, 2022, 9:54am UTC](https://pdfjs.community/t/error-when-changing-default-language/1499/1 "2022-03-25T09:54:41Z")

</div>

**Which product are you using?**  
PDF.js Express Viewer

**PDF.js Express Version**  
|UI version|‘8.3.2’|  
|Core version|‘8.3.0’|  
|Build|‘My8xNi8yMDIyfDJiMGM2Y2IyZA==’|  
|WebViewer Server|false|  
|Full API|false|

**Detailed description of issue**  
Javascript error when trying to setup the FR language : “Uncaught (in promise) TypeError: Cannot set properties of undefined (setting ‘i18n’)”  
Screenshot : [2022-03-25\_10-52-25](https://www.screencast.com/t/oQIevSrd6)

**Expected behaviour**  
just use the right language

**Does your issue happen with every document, or just one?**  
all documents concerned

**Code snippet**  
WebViewer({path: ‘assets/plugins/pdf\_js\_viewer/lib’,  
licenseKey: ‘XXXXX’,  
initialDoc: fichier,  
}, document.getElementById(‘pdf\_viewer’))  
.then(instance =\> {  
const { Core, UI } = instance;  
instance.UI.setLanguage(‘fr’);

```
	Core.documentViewer.addEventListener('documentLoaded', () => {
		instance.Core.documentViewer.zoomTo(2, 0, 300);
	})
});

```

thanks for your help

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/pdfjscommunity/original/1X/ffbcd25c7d423db8d5acd5db201c272f4db306dd.png) [@system](https://pdfjs.community/u/system)\
**Post date:** [March 25, 2022, 9:54am UTC](https://pdfjs.community/t/error-when-changing-default-language/1499/3 "2022-03-25T09:54:46Z")

</div>

**Hello, I’m Ron, an automated tech support bot 🤖**

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:
- [Samples](https://pdfjs.express/documentation/viewer/samples)
- [UI & toolbar customization sample](https://pdfjs.express/documentation/ui-customization/samples)
- [Integrating PDF.js Express Plus into a new Angular project - Sample overview](https://pdfjs.express/documentation/get-started/angular/new-project#sample-overview)

APIs:
- [UI - setLanguage(language)](https://pdfjs.express/api/UI.html#.setLanguage__anchor)
- [UI.Header - getItems()](https://pdfjs.express/api/UI.Header.html#getItems__anchor)
- [Core.DocumentViewer - setDefaultPageColor(color)](https://pdfjs.express/api/Core.DocumentViewer.html#setDefaultPageColor__anchor)

Forums:
- [Am getting this error when loading WebViewer with Vue application](https://pdfjs.community/t/am-getting-this-error-when-loading-webviewer-with-vue-application/1319/1)
- [Is there any CDN url for PDFJS express library](https://pdfjs.community/t/is-there-any-cdn-url-for-pdfjs-express-library/910/15)
- [Error when loading xfdf annotations](https://pdfjs.community/t/error-when-loading-xfdf-annotations/1380/1)

---

<div class="post-metadata">

**Author:** ![dnavarro](https://yyz1.discourse-cdn.com/flex031/user_avatar/pdfjs.community/dnavarro/32/707_2.png) [@dnavarro](https://pdfjs.community/u/dnavarro)\
**Post date:** [March 25, 2022, 5:21pm UTC](https://pdfjs.community/t/error-when-changing-default-language/1499/4 "2022-03-25T17:21:48Z")

</div>

Hi There,

Thanks for your question.

I used your code here and it worked when I changed the quotation marks in the French language, as follows.

```javascript
WebViewer({
   path: ‘assets/plugins/pdf_js_viewer/lib’,
   licenseKey: ‘XXXXX’,
   initialDoc: fichier,
}, document.getElementById(‘pdf_viewer’))
.then(instance => {

   const { Core, UI } = instance;
  
   UI.setLanguage('fr');
   
   Core.documentViewer.addEventListener('documentLoaded', () => {
      instance.Core.documentViewer.zoomTo(2, 0, 300);
   });

});

```

Please let me know if this works for you as well.

Thank you,

Dandara

---

<div class="post-metadata">

**Author:** ![rodolphe](https://avatars.discourse-cdn.com/v4/letter/r/7993a0/32.png) [@rodolphe](https://pdfjs.community/u/rodolphe)\
**Post date:** [March 25, 2022, 6:39pm UTC](https://pdfjs.community/t/error-when-changing-default-language/1499/5 "2022-03-25T18:39:07Z")

</div>

It works ! thanks  
Not sure to understand with this syntax, but it helps !
