Skip to main content

Set fixed languages for patterns in Lektor.

Project description

lektor-fixedlang is a plugin for the Lektor static site generator that marks some patterns in output files with lang attributes.

Why?

It might be the case that a document contains words or phrases that are in a language other than the current document’s language. If not marked properly, these parts will be processed using an incorrect language’s rules (such as for case conversion and hyphenation), and screen readers will pronounce them aloud incorrectly. For example, in Turkish, the uppercase form for i is İ, and the lowercase form for I is ı. If you use the word “Wikipedia” in Turkish text, a text-transform: uppercase CSS rule will cause it to be displayed as “WİKİPEDİA”.

To prevent this, such pieces of text have to be marked using a lang attribute, as in <span lang="en">Wikipedia</span>. This can of course be done manually when writing the content, but that’s going to be inconvenient for content writers, and it can also be easily overlooked.

Installation

To use the plugin, add it to your project:

lektor plugin add lektor-fixedlang

The plugin can be configured using the configs/fixedlang.ini file. Every section is the language code of the patterns in that section. Keys are insignificant except that they have to be unique in their sections.

Example:

[en]
1 = Wikipedia

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

lektor_fixedlang-0.5.tar.gz (5.6 kB view hashes)

Uploaded Source

Built Distribution

lektor_fixedlang-0.5-py3-none-any.whl (5.4 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