summaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/web.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2022-01-11 12:55:25 -0800
committerBryan Newbold <bnewbold@archive.org>2022-01-11 12:55:25 -0800
commit647f034573a4aa7a3191da14c8b6b1321bfe0d65 (patch)
treeeb3cc7929270f10efc22aff83051761ffe3d72da /fatcat_scholar/web.py
parent52576d07393b3511474ef077171c012244b3ccd9 (diff)
downloadfatcat-scholar-647f034573a4aa7a3191da14c8b6b1321bfe0d65.tar.gz
fatcat-scholar-647f034573a4aa7a3191da14c8b6b1321bfe0d65.zip
web: update docs for LangPrefix
Diffstat (limited to 'fatcat_scholar/web.py')
-rw-r--r--fatcat_scholar/web.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/fatcat_scholar/web.py b/fatcat_scholar/web.py
index 495ae98..29c15bc 100644
--- a/fatcat_scholar/web.py
+++ b/fatcat_scholar/web.py
@@ -66,11 +66,13 @@ I18N_LANG_OPTIONS = I18N_LANG_TRANSLATIONS + [
class LangPrefix:
"""
- Looks for a two-character language prefix.
+ Looks for either a two-character URL path prefix, or an Accept-Language
+ HTTP header, to determine which translation of the site to display.
- If there is no such prefix, in the future it could also look at the
- Accept-Language header and try to infer a language from that, while not
- setting the prefix code.
+ A URL path-prefix takes precedence, then an Accept-Language header is
+ considered, and finally a configurable default is used. Any path prefix is
+ stored as a context variable, so that URLs can be re-written in templates
+ to include the prefix.
"""
def __init__(self, request: Request):