Localization | PDF.js language

See original GitHub issue

Hi!

Using PDF file viewer link and assets as per documentation <a href="assets/js/pdf.js/web/viewer.html?file=../../../files/invoice.pdf">Arve</a> and everything works.

  1. Wanted to change pdf.js viewer toolbar language. <a href="assets/js/pdf.js/web/viewer.html#locale=et?file=../../../files/invoice.pdf">Arve</a>

Did not work. Wasn’t able to find any documentation regarding localization. Found other people having the same issue:

Please:

  • Include localization in the documentation and provide a working example
  • Consider assigning toolbar language using html lang attribute from html document. <html lang="et"> for example. Or provide a solution to do it. It would be very easy to use on multilingual pages. Its not only English out there.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kristjan-kurecommented, Jun 24, 2016

Thank you @yurydelendik. This fixed it. Wasn’t able to understand @Snuffleupagus example. Wasn’t sure I should change lines in core js file (e.g PDFJS.locale = (PDFJS.locale === undefined ? navigator.language : PDFJS.locale);

How about using <html lang=""> attribute (website language) to define interface language - if webpage uses another language - change the language in the interface. If html lang is not set use navigator navigator.userLanguage? I mean if we are going to have 5 different languages we need to overwrite the PDFJS.locale every time?

What do you think?

PS! Please do update documentation regarding localization and provide a working example.

0reactions
rjakshayjain13commented, Jul 1, 2020

@yurydelendik @Snuffleupagus What is the suggested way to change locale now? I am only using viewer.html to render the pdf.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PDF.js Express Viewer Localization & Language Support
Change languages. To change languages in PDF.js Express, simply call setLanguage on the instance while passing in the language code defined in the...
Read more >
How to localize pdf.js toolbar? - javascript - Stack Overflow
I'm using Mozilla's pdf.js plugin. I want to know how to localize the toolbar into my native language. Which function will help?
Read more >
Localization: Change Languages in JavaScript PDF Viewer
Localization : Updating Languages in Our JavaScript PDF Viewer · Chinese Simplified / Chinese Traditional (zh-Hans/zh-Hant) · Croatian (hr) · Czech (cs) ·...
Read more >
742099 - Localize pdf.js strings and replace with the final ...
PDF Viewer is currently localized for a few locales by unofficial localizers (add-on developers that speak the language): ...
Read more >
[pdfJS Viewer] How to change the language? - OutSystems
Hello Horacio,. I think ES localization files are not there. I'll add as soon as possible (probably only tomorrow). Cheers. 0.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found