Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation for the key is missing (#download/#error) #1714

Closed
korydondzila opened this issue Mar 13, 2023 · 20 comments
Closed

Translation for the key is missing (#download/#error) #1714

korydondzila opened this issue Mar 13, 2023 · 20 comments
Assignees
Labels
user support You've got a question, or a misconfiguration, or simply need a hint how to get things up and running

Comments

@korydondzila
Copy link

Describe the bug
Similar to this previous issue #559
However this only warnings for #download & #error
Screen Shot 2023-03-13 at 4 04 58 PM

Most functionality is turned off, which explains why other translation warnings don't show up. Note that the downloadButton is turned off.
Screen Shot 2023-03-13 at 4 38 38 PM

Also locale.properties appears to load correctly
Screen Shot 2023-03-13 at 4 41 09 PM

Version info

  • 16.2.5

Desktop (please complete the following information):

  • Chrome
@stephanrauh stephanrauh self-assigned this Mar 13, 2023
@stephanrauh stephanrauh added the bug Something isn't working label Mar 13, 2023
@stephanrauh
Copy link
Owner

Sometimes it's hard to keep up with the UI changes of the pdf.js team... I guess that's what happened here, too. Although this particular error is a bit surprising.

@korydondzila
Copy link
Author

@stephanrauh my assumption is that these show up because the viewer.properties contains no strings for these?

@stephanrauh
Copy link
Owner

Exactly. I assume so, too, without having looked into my source code yet. The interesting question is: these strings used to be there. Why did they vanish? Usually, that's because Mozilla modified their HTML code without telling me.

I'm just happy there are kind developers like you making me aware of these things!

@korydondzila
Copy link
Author

@stephanrauh Gotta love when things like that happen. At least this like my other issue is relatively minor.

Speaking of, annotationLayerRendered works great btw, fixes an issue I also had when using pageRendered that wouldn't fire a second time for subsequent pages... so any style changes made only ever applied to the first page. But my assumption is that that wasn't exactly a bug and since annotationLayerRendered fixes the problem, not an issue.

@stephanrauh
Copy link
Owner

stephanrauh commented Mar 13, 2023

I was just wondering if my comment sounded patronizing. Your reaction indicates it doesn't - but in any case, patronizing isn't something I do. At least I try hard not do so - but nobody's perfect!

I'd like to invite you to help me because I'm drowning in new tickets. In this particular case, this amounts to digging into the history of this file:
https://github.com/mozilla/pdf.js/blob/master/l10n/en-US/viewer.properties

As it turns out, the "download" button has been renamed recently:
mozilla/pdf.js@0377591

So that's what I've got to do - I need to follow the renaming. That's nasty, because I consider that a breaking change, requiring me to increase to the next major version number.

Oops - I wanted to invite you to help me, but trying to provide you with some pointers I couldn't avoid finding the root cause myself. :) But maybe next time?

Best regards,
Stephan

@korydondzila
Copy link
Author

@stephanrauh not patronizing at all, if I ever knew what to look into for any bugs I'd be happy to help. Though I'm glad it seemed to only take you a short while to figure out the exact problem. Domain knowledge does that sometimes.

@korydondzila
Copy link
Author

@stephanrauh in regards to the previous issue #559, what should be done in the case that a 404 is returned when trying to get locale.properties? (this happens to be the case for a non-local environment).

@stephanrauh
Copy link
Owner

Well, that's something that should never happen. It sounds like a configuration mistake.

If you don't want to load locale.propertiesand viewer.properties, you can add an inlined copy of the i18n files to the DOM. I'm describing this approach in the "fast way" tab here: https://pdfviewer.net/extended-pdf-viewer/i18n.

But that doesn't seem to be what you're describing. My best guess is the locale folder doesn't make it to production. So my recommendation is to check this first.

BTW, if all of your users prefer the English language, they're probably happy with the default. Granted, the console is full of error messages, but you can suppress these messages using a custom Window.ngxConsoleFilter(logLevel, message) method (see https://pdfviewer.net/extended-pdf-viewer/filtering-console-log). That's not the approach I'd use, but it's an option.

@korydondzila
Copy link
Author

Thanks, I'll need to dig around the pipeline and figure out what's up and/or ask around on the project. All the warnings actually slows down the pdf loading by a noticeable amount.

@korydondzila
Copy link
Author

Ah it is built, it's just dumped into a storage account, so I likely need to figure out the right path maybe?

@stephanrauh
Copy link
Owner

I'm trying to reproduce your issue, but it doesn't happen on my showcase. As far as I can see, the download button has been renamed in pdf.js 3.5, so it's not an issue in the stable version yet.

My best guess is you've really messed up your locale folder. What's your progress? Can you already confirm or deny that?

In any case, it's always a good idea to double-check this kind of problems by creating a new sandbox project (ng new demo && cd demo && ng add ngx-extended-pdf-viewer).

@stephanrauh
Copy link
Owner

To answer your question: yes, I guess you're right. :)

@korydondzila
Copy link
Author

korydondzila commented Mar 21, 2023

The locale.properties 404 issue got resolved, they had to add .properties file type as mimeMap in web.config for the app service. They are going to make sure it happens on all deployments.

https://stackoverflow.com/questions/51634425/can-not-find-locale-properties-file-from-pdf-js

This was it
Screen Shot 2023-03-21 at 11 39 02 AM

@stephanrauh
Copy link
Owner

Oh. I didn't expect that, but sure, it makes sense. I'm glad you've managed to find the bug!

@stephanrauh stephanrauh added user support You've got a question, or a misconfiguration, or simply need a hint how to get things up and running and removed bug Something isn't working labels Mar 21, 2023
@korydondzila
Copy link
Author

korydondzila commented Mar 23, 2023

@stephanrauh oh uhhh this didn't fix the original bug, this was just the 404 issue I was having.

So the download and error translations is still a problem, unless you have worked on that.

@stephanrauh stephanrauh reopened this Mar 23, 2023
@stephanrauh
Copy link
Owner

I'm not sure. I didn't do anything consciously, but it's possible the magic of my build script fixed the problem. I can't reproduce the issue. Does it still happen on your machine with the latest version?

@korydondzila
Copy link
Author

Still have the issue on 16.2.8

@stephanrauh
Copy link
Owner

Just in case you wonder why I'm not as responsive as I used to be: I was busy preparing a talk at a conference.
https://www.linkedin.com/feed/update/urn:li:activity:7044593138467827712/

@stephanrauh
Copy link
Owner

Hi Kory, what's the current state of the art? Is the bug still there? If it is, I need your help because it doesn't happen on my machine. What happens if you create a fresh new project using

  • ng new test
  • cd test
  • ng add ngx-extended-pdf-viewer
  • plus adding the demo component to the app.component.html?

@stephanrauh
Copy link
Owner

I'm closing the ticket now because I can't reproduce it. If you send me a reproducer, I'll happily re-open it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
user support You've got a question, or a misconfiguration, or simply need a hint how to get things up and running
Projects
None yet
Development

No branches or pull requests

2 participants