Skip to content
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
84 changes: 83 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,85 @@
.idea
.example
go.sum
go.sum

# Sphinx documentation build files
docs/_build/
docs/build/

# Python cache
__pycache__/
*.py[cod]
*$py.class
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# IDEs
.vscode/
.idea/
*.swp
*.swo
*~

# macOS
.DS_Store
.AppleDouble
.LSOverride

# Windows
Thumbs.db
ehthumbs.db
Desktop.ini

# Go files
*.exe
*.exe~
*.dll
*.so
*.dylib
*.test
*.out
go.work

# Temporary files
*.tmp
*.temp
*.log

# Documentation specific
docs/locale/*/LC_MESSAGES/*.mo
docs/.doctrees/
docs/_build/
docs/_static/.doctrees/

# Translation temp files
docs/translate.py
docs/simple_translate.py
docs/fix_po_headers.py
23 changes: 23 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "3.11"
jobs:
pre_build:
- pip install -r docs/requirements.txt
post_build:
- python docs/complete_translate.py

sphinx:
configuration: docs/conf.py
fail_on_warning: false

formats:
- pdf
- htmlzip

python:
install:
- requirements: docs/requirements.txt
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
1 change: 1 addition & 0 deletions docs/_static/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Empty file to ensure _static directory is tracked by git
86 changes: 86 additions & 0 deletions docs/_static/css/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/* Language switcher styles */
.language-switcher {
position: fixed;
top: 10px;
right: 10px;
z-index: 1001;
background: #2980B9;
padding: 8px 12px;
border-radius: 6px;
box-shadow: 0 2px 10px rgba(0,0,0,0.2);
transition: all 0.3s ease;
}

.language-switcher:hover {
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
transform: translateY(-1px);
}

.language-switcher select {
background: transparent;
color: white;
border: 1px solid rgba(255,255,255,0.3);
border-radius: 4px;
padding: 4px 8px;
font-size: 14px;
cursor: pointer;
transition: all 0.3s ease;
}

.language-switcher select:hover {
border-color: rgba(255,255,255,0.6);
background: rgba(255,255,255,0.1);
}

.language-switcher select:focus {
outline: none;
border-color: rgba(255,255,255,0.8);
box-shadow: 0 0 0 2px rgba(255,255,255,0.2);
}

.language-switcher select option {
background: #2980B9;
color: white;
padding: 4px 8px;
}

/* Mobile responsive */
@media (max-width: 768px) {
.language-switcher {
top: 5px;
right: 5px;
padding: 6px 8px;
font-size: 12px;
}

.language-switcher select {
font-size: 12px;
padding: 3px 6px;
}
}

/* RTD theme integration */
.wy-nav-top {
position: relative;
}

/* Ensure language switcher appears above all content */
.language-switcher {
position: fixed !important;
z-index: 9999 !important;
}

/* Additional styles for better visibility */
@media (max-width: 480px) {
.language-switcher {
top: 50px; /* Move down on very small screens to avoid header overlap */
right: 5px;
}
}

/* Hide on print */
@media print {
.language-switcher {
display: none !important;
}
}
69 changes: 69 additions & 0 deletions docs/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
{% extends "!layout.html" %}

{% block extrahead %}
{{ super() }}
<script type="text/javascript">
function switchLanguage() {
var lang = document.getElementById('language-select').value;
var currentPath = window.location.pathname;
var currentSearch = window.location.search;
var currentHash = window.location.hash;

// Detect current language and remove it from path
var pathWithoutLang = currentPath;
if (currentPath.startsWith('/zh_CN/')) {
pathWithoutLang = currentPath.replace('/zh_CN/', '/');
} else if (currentPath.startsWith('/en/')) {
pathWithoutLang = currentPath.replace('/en/', '/');
}

// Construct new URL based on selected language
var newPath;
if (lang === 'en') {
// For ReadTheDocs, English is usually the default
newPath = '/en' + pathWithoutLang;
} else if (lang === 'zh_CN') {
newPath = '/zh_CN' + pathWithoutLang;
}

// Handle local development vs production
var baseUrl = window.location.origin;
if (window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1') {
// Local development - different structure
if (lang === 'en') {
newPath = '/en' + pathWithoutLang;
} else {
newPath = '/zh_CN' + pathWithoutLang;
}
}

// Redirect to new language
window.location.href = baseUrl + newPath + currentSearch + currentHash;
}

// Auto-detect current language and set selector
document.addEventListener('DOMContentLoaded', function() {
var select = document.getElementById('language-select');
if (select) {
var currentPath = window.location.pathname;
if (currentPath.includes('/zh_CN/')) {
select.value = 'zh_CN';
} else {
select.value = 'en';
}
}
});
</script>
{% endblock %}

{% block document %}
<!-- Language Switcher -->
<div class="language-switcher" style="position: fixed; top: 10px; right: 10px; z-index: 1001; background: #2980B9; padding: 8px 12px; border-radius: 6px; box-shadow: 0 2px 10px rgba(0,0,0,0.2);">
<select id="language-select" onchange="switchLanguage()" style="background: transparent; color: white; border: 1px solid rgba(255,255,255,0.3); border-radius: 4px; padding: 4px 8px; font-size: 14px; cursor: pointer;">
<option value="en" style="background: #2980B9; color: white;">🇺🇸 English</option>
<option value="zh_CN" style="background: #2980B9; color: white;">🇨🇳 中文</option>
</select>
</div>

{{ super() }}
{% endblock %}
Loading