Skip to content

Commit 24d27af

Browse files
speco29OriolAbril
andauthored
Add transifex setup to 2.0 release (#368)
* added .tx/config and locales folders for different languages * adds .tx/config and locales folders for new branch * added the .tx\config file for resources * adding content to .tx/config * deleting the content * removed the en folders and pushed content to transifex * correcting the slug * Pulled some translation * fix tx config and test 'tx pull' options * Adds conf.py, ci/build_websites.gh and labguage.json * remove extra things from conf.py --------- Co-authored-by: Oriol (ZBook) <[email protected]>
1 parent d45d24f commit 24d27af

24 files changed

+4031
-34
lines changed

.github/workflows/build-gh-pages.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ jobs:
3333
with:
3434
github_token: ${{ secrets.GITHUB_TOKEN }}
3535
publish_dir: ./DISCOVER/_build/html
36-
keep_files: true
36+
keep_files: true

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
DISCOVER/_build/
33
DISCOVER/_tags/
44

5+
# helper files for translations
6+
*.mo
7+
58
# Pycharm
69
.idea/
710

.tx/config

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
[main]
2+
host = https://app.transifex.com
3+
4+
[o:numfocus:p:DISCOVER-Cookbook:r:01_about]
5+
file_filter = locales/<lang>/LC_MESSAGES/01_about.po
6+
source_file = DISCOVER/_build/gettext/01_about.pot
7+
type = PO
8+
minimum_perc = 0
9+
replace_edited_strings = false
10+
keep_translations = false
11+
12+
[o:numfocus:p:DISCOVER-Cookbook:r:02_minimal_measures]
13+
file_filter = locales/<lang>/LC_MESSAGES/02_minimal_measures.po
14+
source_file = DISCOVER/_build/gettext/02_minimal_measures.pot
15+
type = PO
16+
minimum_perc = 0
17+
replace_edited_strings = false
18+
keep_translations = false
19+
20+
[o:numfocus:p:DISCOVER-Cookbook:r:03_organizing_committee]
21+
file_filter = locales/<lang>/LC_MESSAGES/03_organizing_committee.po
22+
source_file = DISCOVER/_build/gettext/03_organizing_committee.pot
23+
type = PO
24+
minimum_perc = 0
25+
replace_edited_strings = false
26+
keep_translations = false
27+
28+
[o:numfocus:p:DISCOVER-Cookbook:r:04_venue_selection]
29+
file_filter = locales/<lang>/LC_MESSAGES/04_venue_selection.po
30+
source_file = DISCOVER/_build/gettext/04_venue_selection.pot
31+
type = PO
32+
minimum_perc = 0
33+
replace_edited_strings = false
34+
keep_translations = false
35+
36+
[o:numfocus:p:DISCOVER-Cookbook:r:05_catering]
37+
file_filter = locales/<lang>/LC_MESSAGES/05_catering.po
38+
source_file = DISCOVER/_build/gettext/05_catering.pot
39+
type = PO
40+
minimum_perc = 0
41+
replace_edited_strings = false
42+
keep_translations = false
43+
44+
[o:numfocus:p:DISCOVER-Cookbook:r:06_childcare]
45+
file_filter = locales/<lang>/LC_MESSAGES/06_childcare.po
46+
source_file = DISCOVER/_build/gettext/06_childcare.pot
47+
type = PO
48+
minimum_perc = 0
49+
replace_edited_strings = false
50+
keep_translations = false
51+
52+
[o:numfocus:p:DISCOVER-Cookbook:r:07_code_of_conduct]
53+
file_filter = locales/<lang>/LC_MESSAGES/07_code_of_conduct.po
54+
source_file = DISCOVER/_build/gettext/07_code_of_conduct.pot
55+
type = PO
56+
minimum_perc = 0
57+
replace_edited_strings = false
58+
keep_translations = false
59+
60+
[o:numfocus:p:DISCOVER-Cookbook:r:08_grants_scholarships]
61+
file_filter = locales/<lang>/LC_MESSAGES/08_grants_scholarships.po
62+
source_file = DISCOVER/_build/gettext/08_grants_scholarships.pot
63+
type = PO
64+
minimum_perc = 0
65+
replace_edited_strings = false
66+
keep_translations = false
67+
68+
[o:numfocus:p:DISCOVER-Cookbook:r:09_participant_selection]
69+
file_filter = locales/<lang>/LC_MESSAGES/09_participant_selection.po
70+
source_file = DISCOVER/_build/gettext/09_participant_selection.pot
71+
type = PO
72+
minimum_perc = 0
73+
replace_edited_strings = false
74+
keep_translations = false
75+
76+
[o:numfocus:p:DISCOVER-Cookbook:r:10_event_registration]
77+
file_filter = locales/<lang>/LC_MESSAGES/10_event_registration.po
78+
source_file = DISCOVER/_build/gettext/10_event_registration.pot
79+
type = PO
80+
minimum_perc = 0
81+
replace_edited_strings = false
82+
keep_translations = false
83+
84+
[o:numfocus:p:DISCOVER-Cookbook:r:11_inclusive_practices_during_checkin]
85+
file_filter = locales/<lang>/LC_MESSAGES/11_inclusive_practices_during_checkin.po
86+
source_file = DISCOVER/_build/gettext/11_inclusive_practices_during_checkin.pot
87+
type = PO
88+
minimum_perc = 0
89+
replace_edited_strings = false
90+
keep_translations = false
91+
92+
[o:numfocus:p:DISCOVER-Cookbook:r:12_assessment]
93+
file_filter = locales/<lang>/LC_MESSAGES/12_assessment.po
94+
source_file = DISCOVER/_build/gettext/12_assessment.pot
95+
type = PO
96+
minimum_perc = 0
97+
replace_edited_strings = false
98+
keep_translations = false
99+
100+
[o:numfocus:p:DISCOVER-Cookbook:r:14_how_to_contribute]
101+
file_filter = locales/<lang>/LC_MESSAGES/14_how_to_contribute.po
102+
source_file = DISCOVER/_build/gettext/14_how_to_contribute.pot
103+
type = PO
104+
minimum_perc = 0
105+
replace_edited_strings = false
106+
keep_translations = false
107+
108+
[o:numfocus:p:DISCOVER-Cookbook:r:intro]
109+
file_filter = locales/<lang>/LC_MESSAGES/intro.po
110+
source_file = DISCOVER/_build/gettext/intro.pot
111+
type = PO
112+
minimum_perc = 0
113+
replace_edited_strings = false
114+
keep_translations = false

DISCOVER/_config.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

DISCOVER/_static/languages.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[
2+
{
3+
"code": "en",
4+
"name_local": "English",
5+
"direction": "ltr"
6+
},
7+
{
8+
"code": "es",
9+
"name_local": "Español",
10+
"direction": "ltr",
11+
"hidden": true
12+
}
13+
14+
]
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<div class="dropdown">
2+
<button class="btn btn-sm btn-outline-secondary dropdown-toggle" type="button" id="language-switcher-button"
3+
data-bs-toggle="dropdown" aria-expanded="false">
4+
{{current_language_name}}
5+
</button>
6+
<ul class="dropdown-menu" aria-labelledby="language-switcher-button">
7+
{% for item in languages %}
8+
<li>
9+
<a class="dropdown-item{% if current_language == item.code %}active{% endif %}"
10+
href="{{ baseurl }}/{{ current_version }}/{{ item.code }}/{{ pagename }}.html"
11+
{% if item.direction %}dir="{{ item.direction }}"{% endif %}>
12+
{{ item.name_local }}
13+
</a>
14+
</li>
15+
{% endfor %}
16+
</ul>
17+
</div>

DISCOVER/conf.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import json
2+
import os
3+
4+
version = os.environ.get("WEBSITE_VERSION", "dev")
5+
language = os.environ.get("WEBSITE_LANGUAGE", "en")
6+
7+
baseurl = 'https://discover-cookbook.numfocus.org'
8+
9+
# Load language data from languages.json
10+
language_json_path = os.path.join(os.path.dirname(__file__), '_static', 'languages.json')
11+
language_data = []
12+
current_language_name = None
13+
if os.path.exists(language_json_path):
14+
with open(language_json_path, 'r', encoding='utf-8') as f:
15+
all_languages = json.load(f)
16+
17+
# Get the current language name
18+
current_language_name = next((lang['name_local'] for lang in all_languages if lang['code'] == language), language)
19+
20+
# Filter out hidden languages for the dropdown
21+
language_data = [lang for lang in all_languages if not lang.get('hidden', False)]
22+
23+
html_context = {
24+
"languages": language_data,
25+
"current_language_name": current_language_name,
26+
"current_language": language,
27+
"current_version": version,
28+
"baseurl": baseurl
29+
}
30+
31+
html_baseurl = baseurl
32+
33+
author = 'Community'
34+
comments_config = {'hypothesis': False, 'utterances': False}
35+
copyright = '2023'
36+
exclude_patterns = ['**.ipynb_checkpoints', '.DS_Store', 'Thumbs.db', '_build']
37+
extensions = ['sphinx_togglebutton', 'sphinx_copybutton', 'myst_nb', 'jupyter_book', 'sphinx_external_toc', 'sphinx.ext.intersphinx', 'sphinx_design', 'sphinx_book_theme', 'sphinx_tags', 'sphinx_jupyterbook_latex', 'sphinx_multitoc_numbering']
38+
external_toc_exclude_missing = False
39+
external_toc_path = '_toc.yml'
40+
html_baseurl = ''
41+
html_favicon = ''
42+
html_logo = 'logo.png'
43+
html_sourcelink_suffix = ''
44+
html_static_path = ['_static']
45+
html_theme = 'sphinx_book_theme'
46+
templates_path = ["_templates"]
47+
html_theme_options = {
48+
'search_bar_text': 'Search this book...',
49+
'launch_buttons': {'notebook_interface': 'classic', 'binderhub_url': '', 'jupyterhub_url': '', 'thebe': False, 'colab_url': '', 'deepnote_url': ''},
50+
'path_to_docs': 'DISCOVER',
51+
'repository_url': 'https://github.com/numfocus/DISCOVER-Cookbook/',
52+
'repository_branch': 'main',
53+
'extra_footer': '',
54+
'home_page_in_toc': True,
55+
'announcement': '',
56+
'analytics': {'google_analytics_id': '', 'plausible_analytics_domain': '', 'plausible_analytics_url': 'https://plausible.io/js/script.js'},
57+
'use_repository_button': True,
58+
'use_edit_page_button': False,
59+
'use_issues_button': True,
60+
61+
62+
"article_header_start": ["toggle-primary-sidebar","version-switcher","language-switcher"],
63+
"navigation_with_keys": False,
64+
"show_version_warning_banner": True,
65+
"switcher": {
66+
"json_url": "https://discover-cookbook.numfocus.org/versions.json",
67+
"version_match": version,
68+
},
69+
}
70+
71+
html_title = 'DISCOVER'
72+
latex_engine = 'pdflatex'
73+
myst_enable_extensions = ['colon_fence', 'dollarmath', 'linkify', 'substitution', 'tasklist']
74+
myst_url_schemes = ['mailto', 'http', 'https']
75+
nb_execution_allow_errors = False
76+
nb_execution_cache_path = ''
77+
nb_execution_excludepatterns = []
78+
nb_execution_in_temp = False
79+
nb_execution_mode = 'force'
80+
nb_execution_timeout = 30
81+
nb_output_stderr = 'show'
82+
numfig = True
83+
pygments_style = 'sphinx'
84+
suppress_warnings = ['etoc.toctree']
85+
tags_create_tags = True
86+
tags_extension = ['md']
87+
use_jupyterbook_latex = True
88+
use_multitoc_numbering = True

DISCOVER/intro.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
(intro)=
21
# DISCOVER Cookbook
32

43
![disc-horizontal-rgb-tl](https://user-images.githubusercontent.com/7980466/34578828-09c97342-f14c-11e7-85b5-35b49567bef4.png)

ci/build_website.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
echo "Starting build process..."
3+
4+
# Get parameters with defaults
5+
VERSION=${VERSION:-${1:-"2.0"}}
6+
LANGUAGE=${LANGUAGE:-${2:-"en"}}
7+
8+
echo "Building version: $VERSION, language: $LANGUAGE"
9+
10+
# Install dependencies
11+
pip install -r requirements.txt
12+
13+
# Clean tags directory
14+
rm -rf DISCOVER/_tags/*
15+
16+
17+
echo "Building $LANGUAGE version..."
18+
WEBSITE_VERSION="$VERSION" WEBSITE_LANGUAGE="$LANGUAGE" sphinx-build -b html DISCOVER/ DISCOVER/_build/html

0 commit comments

Comments
 (0)