Skip to main content

A plugin to add relative links to Google Translate queries

Project description

mkdocs-google-translate

Build Status GitHub latest commit PyPi MIT license codecov

A mkdocs plugin to add relative paths to Google Translate queries

img.png

Install using pip install mkdocs-google-translate

Usage

Activate the plugin in mkdocs.yml by adding the following lines, replace the values of _x_tr_sl and _x_tr_tl to match your site:

extra:
  alternate:
      # Original Language
    - name: English
      lang: 'en'
      link: '%GT_RELATIVE_URL%'  # For relative urls back to original language
      # Extra languages
    - name: Norsk
      lang: 'no'
      link: 'https://translate.goog/?_x_tr_sl=en&_x_tr_tl=no'
      # _x_tr_sl = source language
      # _x_tr_tl = translation language

plugins:
  - search
  - google-translate:
      url: example.com  # optional (required for local testing)

Note: If you have no plugins entry in your config file yet, you'll likely also want to add the search plugin. MkDocs enables it by default if there is no plugins entry set, but now you have to enable it explicitly.

Incompatabilities

This plugin is somewhat incompatible with the mkdocs feature navigation.instant, due to the fact that the page heading never changes with the feature enabled.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mkdocs-google-translate-1.2.0.tar.gz (4.4 kB view hashes)

Uploaded Source

Built Distribution

mkdocs_google_translate-1.2.0-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page