RussCoder/djvujs

Standard error message for common HTTP response error codes

Closed this issue · 11 comments

When embedding djvujs in web pages for digital archives that contents are changing over time I often encounter these common HTTP error responses:

  • 404 Not found : occurs when user clicks some older link.
  • 403 Forbidden : when user doesn't have permission to open the document.
  • 500 Internal server error : humans make software :)

Would like to get a short translatable explanatory message for these responses.

Currently we have (for Not found):

Error: Response status code: 404
Response status text:

image

Yeah, it can be done. But before it I have to make error messages translatable in general. Not only web request errors.
Once it's done, I will notify you here.

Now error messages can be translated. I haven't made a new release yet, so you need to start the viewer locally to see the new functionality and the list of untranslated phrases.

Maybe write some short node app to show only not translated phrases in all languages, and put current missing translations in some place?

Well, it makes sense. I think it will be better to just put all new keys with null values to all dictionaries. I can write a script to do it automatically.

As for the list of untranslated phrases it's available in a pop up window for each language when you click on the warning sign icon near the language name.

I have a suggestion to put translation strings in 2 lines: first string is original English line, next - localized line, e.g.:
in English.js:

    "Add more":
        "Add more",

in French.js:

    "Add more":
        "Ajouter une traduction",

image
As you can see in the picture above, a screenshot from some diff-program (there are many), it's easy to spot if something is missing. You can easy spot if English string was changed.

Easy to spot if new strings to translate were added:
image

When original string was changed, then it's not so easy:
image

And now see how it would look if these strings were in new lines (easy to spot):
image

Yes, it's handy. But I already do it for most strings. Although not for short ones. Maybe it is better to standardize them all.

Exactly, if we do the same for all strings then the "diff pattern" is such that it's very easy to spot changes:

  • "all fine" pattern = 1 line diff stripes: original English strings match and translated strings will give 1 line diff, because translated string in most cases will be different from original.
  • "look here" pattern: 2 or more lines are different.

And we shouldn't care if locale JSON file is bigger, because it will be minimized during build.

I'm moving forward with the thing I'm thinking about: "How do we translate efficiently in the open source world?".

1st English string as a key (done)
2nd "1 stripe diff is OK" (proposed, in pull request).
3rd Original and translated should be exactly at the same lines (proposed, in pull request, sorry, only for Swedish)

This line:
// Marker to align en-sv lines, e.g. any line in other locale starts at the same line in original (English). We have to improve here, too.

But it's probably too much extreme, not needed.

I think this issue is resolved. I even added a script to automatically add new keys with null values to all the dictionaries. French.js has nulls now.