Thanks for helping to improve the Gramps Web documentation! This guide will help you get started with contributing.
The documentation pages are written in Markdown and stored in the docs/en directory. Each page on grampsweb.org corresponds to a .md file in this directory.
The navigation structure is defined in the mkdocs.yml file at the root of the repository. This file controls how the pages are organized and displayed in the sidebar.
There is a automated translation service implemented, which will translate all new/changed files in docs/en to the other languages.
To make changes to the documentation, simply change the relevant Markdown files in the docs/en directory and submit a pull request.
If you are proficient with git, you can clone the repository, make your changes locally, and push them to your fork. If you're not familiar with git, you can also edit files directly on Github using the web interface.
To add a new page to the documentation, create a new Markdown file in the docs/en directory and add it to the mkdocs.yml file under the appropriate section. Make sure to follow the existing structure and formatting. If you can, also add the translations for the navigation under mkdocs.yml .
The documentation currently supports:
- English (en) - Default
- Deutsch (de) - German
- Français (fr) - French
- Español (es) - Spanish
- 简体中文 (zh) - Simplified Chinese
- Tiếng Việt (vi) - Vietnamese
- Türkçe (tr) - Turkish
- Русский (ru) - Russian
- Português (pt) - Portuguese
- 日本語 (ja) - Japanese
- Dansk (da) - Danish
- Suomi (fi) - Finnish
- Italiano (it) - Italian
- Українська (uk) - Ukrainian
The translations of the actual .md files are managed automatically using OpenAI GPT-4o-mini. The navigation (under mkdocs.yml) and home.html need to be translated manually.
To add a new language to the documentation:
-
Update the configuration in
translate.pyand add the Language under LANGUAGE_NAMES:CONFIG = { "translation": { "target_languages": ["de", "fr", "es"], # Add your language code ... } } # Language names for prompting and display LANGUAGE_NAMES = { "de": "German", "fr": "French", "es": "Spanish", "it": "Italian", "en": "English" }
-
Add the language to MkDocs in
mkdocs.ymland add the navigation translations:plugins: - i18n: languages: - locale: es name: Español build: true nav_translations: Home: Inicio Features: Características # ... add all navigation translations
-
Extend github workflow in
.github\workflows\translate.yml:- name: Check for translation changes id: check-changes if: steps.changed-files.outputs.changed == 'true' run: | # Check if any translations were actually changed # ADD NEW LANGUAGES HERE if git diff --quiet docs/de/ docs/fr/ docs/es/ docs/zh-hans/ docs/vi/ docs/uk/ docs/tr/ docs/ru/ docs/pt/ docs/ja/; then echo "No translation changes" echo "has_changes=false" >> $GITHUB_OUTPUT else echo "Translation changes detected" echo "has_changes=true" >> $GITHUB_OUTPUT fi - name: Commit translations if: steps.check-changes.outputs.has_changes == 'true' run: | git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" # ADD NEW LANGUAGES HERE git add docs/de/ docs/fr/ docs/es/ docs/zh-hans/ docs/vi/ docs/uk/ docs/tr/ docs/ru/ docs/pt/ docs/ja/ # Create commit message with list of translated files COMMIT_MSG="Auto-translate documentation\n\nTranslated files:\n" for file in ${{ steps.changed-files.outputs.files }}; do COMMIT_MSG="${COMMIT_MSG}- ${file}\n" done git commit -m "$(echo -e "$COMMIT_MSG")" -
Add homepage translations in
overrides/translations/home.yml:hero: es: title: "Gramps Web" description: "..." demo_button: "..." learn_more: es: title: "..." # ... add all homepage translations
-
Run the translation:
python translate.py --lang es
All English source files are in docs/en/. When you modify an English file, translations are automatically generated via GitHub Actions. For manual translation:
# Set up your OpenAI API key
cp .env.example .env
# Add your API key to .env
# Translate specific file
python translate.py --file user-guide/blog.md --lang de
# Translate all files
python translate.py --lang allIf you are just editing or adding Markdown to a page, there may not be a need to preview your changes. However, if you are making significant changes or adding new pages, you can preview your changes locally by following these steps:
- Install the necessary dependencies:
python -m pip install -r requirements.txt- Run the MkDocs development server:
python -m mkdocs serve -a localhost:8211- Open your web browser and go to http://localhost:8211 to see your changes live. The web server will automatically reload when you make changes to the Markdown files.