Skip to main content

latex-ji18n (LaTeX -> Jinja2 -> internacionalization)

Set of tools to render LaTeX documents in multiple languages using Jinja2 Python library and some conventions inspired by jekyll-multiple-languages-plugin.

So you have a LaTeX document that you want to internationalize. The first step is convert your project in a template. Using latex-ji18n command line tool, you can render YAML files into LaTeX Jinja2 templates.

Install

You need a pdflatex binary available at the PATH. Then run:

pip install latex-ji18n

Separation of data, style and layout

This structure of directories is the workflow that imposes this utility working with it:

 ├── _config
 │   ├── data.yml
 │   ├── layout.yml
 │   ├── style.yml
 │   └── _private
 │       ├── data.yml
 │       └── layout.yml
 ├── dist
 │   ├── en.pdf
 │   ├── es.pdf
 │   └── fr.pdf
 ├── _i18n
 │   ├── _private
 │   │   └── es.yml
 │   ├── en.yml
 │   ├── es.yml
 │   └── fr.yml
 └── src
     ├── template.tex
     └── your-assets.jpg

The process is simple, you write your replacements in src/template.tex Jinja2 template file with \BLOCK{} and \VAR{} syntax, write your data or options inside _i18n/ and _config/ folders YAML files, run latex-ji18n to compile the PDFs and you will see each one for each language in dist/ folder.

Convention for separate data files

  • _private/: Directories that stores all the sensitive data that you don't want to include, for example, sharing your repositorie with GIT. This folders are totally optional. Inside each one, you must keep the same files structure that in _i18n/ and _config/ directories.
  • data.yml: Data that you want to include in the context, at the root of the dictionary, common to all languages. All the fields stored here are included at the root of the context. You can't include the fields layout nor style in the root of the context for data files.
  • layout.yml: Designed to store some layout options for the template. Fields stored here are available for the context in the layout dictionary.
  • style.yml: Designed to store style options for the template. Fields stored here are available for the context in the style dictionary.
  • _i18n/{language}.yml: Overrides data for the context. Designed to localize your data output. An output file will be created for every {language}.yml file, with the name of {language}.pdf.

Context creation

The contexts are created updating a dictionary iterating over files in next order:

  • config/data.yml
  • config/layout.yml
  • config/style.yml
  • config/_private/data.yml
  • config/_private/layout.yml
  • config/_private/style.yml
  • _i18n/{language}.yml
  • _i18n/_private/{language}.yml

Metadata

Release files for latex-ji18n 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for latex-ji18n 0.0.2
File Size Uploaded Provenance Actions
latex-ji18n-0.0.2.tar.gz 10.9 kB Without provenance Details for latex-ji18n-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for latex-ji18n 0.0.2
File Interpreter ABI Platform Actions
latex_ji18n-0.0.2-py2.py3-none-any.whl Python 2, Python 3 none any Details for latex_ji18n-0.0.2-py2.py3-none-any.whl

Total release size: 21.9 kB

Release files / latex-ji18n-0.0.2.tar.gz

Download URL latex-ji18n-0.0.2.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
08e625900f5df85edfa7ee96aa0353672c43971b3c8afd52fc40a5156a1b5ab2
BLAKE2b-256 checksum
How to use checksums
b4feebdbef541c8bd60a27d0439a8da468b6739db0c422aaedea67f94ee85e56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Release files / latex_ji18n-0.0.2-py2.py3-none-any.whl

Download URL latex_ji18n-0.0.2-py2.py3-none-any.whl
Size 11.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
46c9ef7d666e913e4496843c261e8a969e1317b51b6e9d87bbb184b0abe34878
BLAKE2b-256 checksum
How to use checksums
e0ccea9fbc85982ff39f5aae84aaf168110c56fe2b0496835a0c73472f5603b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.2

Security for latex-ji18n 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page