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

Enable translation for the remaining strings on the search results page #752

Merged
merged 2 commits into from
Aug 19, 2022

Conversation

krakan
Copy link
Contributor

@krakan krakan commented Aug 18, 2022

A few strings on the search results pages were hard coded an not enclosed with the translation function which gave the page a half translated impression.

Description

  • add the remaining strings to the text dict in query.html
    • for matching / captures of
    • by
    • Mime Type
    • HTTP Status
  • replace the occurrences of those strings with the corresponding dict element in query.js
  • tidy up the usage of bold in query.js for consistency
  • use the tsToDate() function also for the timestamps for search results without matchType
  • use the document.documentElement.lang parameter to decide how to localize the timestamps in query.js

The last item means that if the user has chosen a language for the page the timestamps will be formatted accordingly; otherwise the locale of the browser will control the formatting. It is totally feasible to use different language settings for the browser and the content.

Motivation and Context

All other pages can be completely localized. This was as far as I can tell the remaining missing strings.

Screenshots (if appropriate):

Before:
2022-08-18-093945_1049x219_scrot

After:
2022-08-18-091951_1048x216_scrot

(The National Library logo and the "Logga in" link are local customizations and not part of this change.)

Types of changes

  • Replay fix (fixes a replay specific issue)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added or updated tests to cover my changes.
  • All new and existing tests passed.

The python setup.py test command fails early with a versioning conflict when running locally - with or without this change. I appears that the test subsystem does not care about version limitations in requirements.txt when installing python modules. As this is a non-functional change, there probably aren't any test for it anyway.

Trying to use localized ordinal suffixes for dates is a hard problem as there is no built in support for it in Javascript which I guess is why most timestamp-to-string implementations don't use ordinal suffixes.

@ikreymer
Copy link
Member

Thank you for adding this!

@ikreymer ikreymer merged commit 0cc912d into webrecorder:main Aug 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants