Skip to content

Commit 00b693c

Browse files
committed
Fixed proposed changes
1 parent 15f6196 commit 00b693c

File tree

3 files changed

+19
-11
lines changed

3 files changed

+19
-11
lines changed

DISCOVER/_static/versions.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
[
2+
{
3+
"version": "dev",
4+
"url": "https://discover-cookbook.numfocus.org/dev/",
5+
"preferred": true
6+
},
27
{
38
"version": "2.0",
4-
"preferred": true,
59
"url": "https://discover-cookbook.numfocus.org/2.0/"
610
},
711
{
812
"version": "1.0",
913
"url": "https://discover-cookbook.numfocus.org/1.0/"
1014
}
11-
12-
]
15+
]

DISCOVER/_templates/language-switcher.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="dropdown">
22
<button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" id="language-switcher-button"
33
data-bs-toggle="dropdown" aria-expanded="false">
4-
{{ language_names[current_language] }}
4+
{{ current_language_name }}
55
</button>
66
<ul class="dropdown-menu" aria-labelledby="language-switcher-button">
77
{% for item in languages %}

DISCOVER/conf.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88

9-
version = '2.0'
9+
version = 'dev'
1010
language = 'en'
1111
baseurl = 'https://discover-cookbook.numfocus.org'
1212

@@ -16,11 +16,17 @@
1616
# Load language data from languages.json
1717
language_json_path = os.path.join(os.path.dirname(__file__), '_static', 'languages.json')
1818
language_data = []
19+
current_language_name = None
20+
1921
if os.path.exists(language_json_path):
2022
with open(language_json_path, 'r', encoding='utf-8') as f:
2123
all_languages = json.load(f)
22-
# Filter out hidden languages
23-
language_data = [lang for lang in all_languages if not lang.get('hidden', False)]
24+
25+
# Get the current language name
26+
current_language_name = next((lang['name_local'] for lang in all_languages if lang['code'] == language), language)
27+
28+
# Filter out hidden languages for the dropdown
29+
language_data = [lang for lang in all_languages if not lang.get('hidden', False)]
2430

2531
# Create a mapping of language codes to their localized names
2632
language_names = {}
@@ -32,6 +38,7 @@
3238
html_context = {
3339
"languages": language_data,
3440
"language_names": language_names,
41+
"current_language_name": current_language_name,
3542
"current_language": language,
3643
"current_version": version,
3744
"baseurl": baseurl
@@ -74,10 +81,8 @@
7481
"navigation_with_keys": False,
7582
"show_version_warning_banner": True,
7683
"switcher": {
77-
"json_url": (
78-
"_static/versions.json"
79-
# "https://discover-cookbook.numfocus.org/DISCOVER/_static/versions.json"
80-
),
84+
"json_url":"_static/versions.json",
85+
# "https://discover-cookbook.numfocus.org/_static/versions.json,"
8186
"version_match": version,
8287
},
8388
}

0 commit comments

Comments
 (0)