Examples¶
In this document, we detail a few more involved examples with project configurations.
Handling Excludes¶
Say, you want to use two localization flows for a project. You have one general workflow, but also an exceptional workflow for some sub-parts of your project. This can be implemented with a hierarchy of included and excluded configuration files. As excludes are only allowed in the top-level configuration files, it requires a few files, but it also provides a clear structure.
Overview¶
These are the configuration files we’re going to use:
Entry points¶
There are two entry points, one for each workflow. l10n-general.toml
is the
entry point for the general workflow, while l10n-exception.toml
is the other.
Both only contain includes and excludes.
l10n-general.toml
:
basepath = "."
[[includes]]
path = "configs/general.toml"
[[excludes]]
path = "configs/exception.toml"
[[excludes]]
path = "configs/never.toml"
l10n-exception.toml
:
basepath = "."
[[includes]]
path = "configs/exception.toml"
[[excludes]]
path = "configs/never.toml"
Child configs¶
These configs include the actual configuration content, including locale lists et al. They all start with the same preamble to set the base path to the top of the project:
basepath = ".."
Then they list the locales they cover, and some [[paths]]
configurations.
In practice, they could also have further [[includes]]
instructions.
configs/general.toml
basepath = ".."
locales = ["de", "fr", "it"]
[[paths]]
reference = "en/**"
l10n = "{locale}/**"
configs/exception.toml
basepath = ".."
locales = ["de", "fr"]
[[paths]]
reference = "en/special/**"
l10n = "{locale}/special/**"
configs/never.toml
basepath = ".."
[[paths]]
reference = "en/special/feature-without-german.ftl"
l10n = "{locale}/special/feature-without-german.ftl"
locales = ["de"]