Skip to content

Commit

Permalink
Don't fallback to if the host doesnt have the matching locale
Browse files Browse the repository at this point in the history
  • Loading branch information
rgaudin committed Jan 16, 2023
1 parent 18d9f36 commit f8a8ddb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed 404 page (#96)
- Dont't crash on missing Location headers on potential redirect
- Fixed incorrect ISO-639-3 --lang not replaced with `eng`
- Don't fallback to `eng` if the host doesnt have the matching locale
- Using wabac.js 2.15.0

## [1.4.3] - 2022-06-21
Expand Down
7 changes: 6 additions & 1 deletion src/warc2zim/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,16 @@ def run(self):
try:
lang_data = get_language_details(self.language)
self.language = lang_data["iso-639-3"]
setlocale(pathlib.Path(__file__).parent, lang_data.get("iso-639-1"))
except Exception:
logger.error(f"Invalid language setting `{self.language}`. Using `eng`.")
self.language = "eng"

# try to set locale to language. Might fail (missing locale)
try:
setlocale(pathlib.Path(__file__).parent, lang_data.get("iso-639-1"))
except Exception:
...

self.env = self.init_env()

# init head insert
Expand Down

0 comments on commit f8a8ddb

Please sign in to comment.