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

Translate settings schema #205

Merged
merged 1 commit into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions jupyterlab_server/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,19 @@ def add_handlers(handlers, extension_app):
setting_path = ujoin(extension_app.settings_url, '(?P<schema_name>.+)')
handlers.append((setting_path, SettingsHandler, settings_config))

# Handle translations.
## Translations requires settings as the locale source of truth is stored in it
if extension_app.translations_api_url:
# Handle requests for the list of language packs available.
# Make slash optional.
translations_path = ujoin(extension_app.translations_api_url, '?')
handlers.append((translations_path, TranslationsHandler, settings_config))

# Handle requests for an individual language pack.
translations_lang_path = ujoin(
extension_app.translations_api_url, '(?P<locale>.*)')
handlers.append((translations_lang_path, TranslationsHandler, settings_config))

# Handle saved workspaces.
if extension_app.workspaces_dir:

Expand Down Expand Up @@ -279,18 +292,6 @@ def add_handlers(handlers, extension_app):
}
))

# Handle translations.
if extension_app.translations_api_url:
# Handle requests for the list of language packs available.
# Make slash optional.
translations_path = ujoin(extension_app.translations_api_url, '?')
handlers.append((translations_path, TranslationsHandler, {'lab_config': extension_app}))

# Handle requests for an individual language pack.
translations_lang_path = ujoin(
extension_app.translations_api_url, '(?P<locale>.*)')
handlers.append((translations_lang_path, TranslationsHandler, {'lab_config': extension_app}))

# Let the lab handler act as the fallthrough option instead of a 404.
fallthrough_url = ujoin(extension_app.app_url, r'.*')
handlers.append((fallthrough_url, NotFoundHandler))
Expand Down
Loading