From 470cfc2c05678eea83b92626478f8d8efafeb9b1 Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Wed, 9 Aug 2017 17:01:15 +0200 Subject: [PATCH 1/2] bpo-31159: fix language switch regex on unknown yet built languages. (#3039) This fix a regex issue (a missing non-matching group around an 'or' list) and the specific possible case where a translation is built but not yet in known by the picker, but not explicitly listing possible languages in the regex. (cherry picked from commit 122081deef86174beee965be1207fa46ea23533d) --- Doc/tools/static/switchers.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/tools/static/switchers.js b/Doc/tools/static/switchers.js index 470ff6d33b72b9..8449b9fd66dae7 100644 --- a/Doc/tools/static/switchers.js +++ b/Doc/tools/static/switchers.js @@ -109,7 +109,7 @@ // Returns the path segment of the language as a string, like 'fr/' // or '' if not found. function language_segment_from_url(url) { - var language_regexp = '\.org/(' + Object.keys(all_languages).join('|') + '/)'; + var language_regexp = '\.org/([a-z]{2}(?:-[a-z]{2})?/)'; var match = url.match(language_regexp); if (match !== null) return match[1]; @@ -119,7 +119,7 @@ // Returns the path segment of the version as a string, like '3.6/' // or '' if not found. function version_segment_in_url(url) { - var language_segment = '(?:(?:' + Object.keys(all_languages).join('|') + ')/)'; + var language_segment = '(?:[a-z]{2}(?:-[a-z]{2})?/)'; var version_segment = '(?:(?:' + version_regexs.join('|') + ')/)'; var version_regexp = '\\.org/' + language_segment + '?(' + version_segment + ')'; var match = url.match(version_regexp); From caa566b5b2c30db8c93513c6db60e278c014bd27 Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Tue, 8 Aug 2017 23:26:46 +0200 Subject: [PATCH 2/2] bpo-31149: Doc: Add Japanese to the language switcher. (#3028) (cherry picked from commit c82b7f332aff606af6c9c163da75f1e86514125e) --- Doc/tools/static/switchers.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Doc/tools/static/switchers.js b/Doc/tools/static/switchers.js index 8449b9fd66dae7..ff23202a5e0fd7 100644 --- a/Doc/tools/static/switchers.js +++ b/Doc/tools/static/switchers.js @@ -21,6 +21,7 @@ var all_languages = { 'en': 'English', 'fr': 'Français', + 'ja': 'Japanese', }; function build_version_select(current_version, current_release) {