Draft
Conversation
Owner
|
Hello @rose-a , that sounds like an amazing proposal, I'm impressed! Please bear with me while I find the time to get my head into it properly and answer. Thanks! |
92052dd to
d6c42a9
Compare
Contributor
Author
|
Hi there, it's been a while now... I've rebased this PR on the current main branch and added support for the I guess this has propably slipped through, I'm still interested in getting this functionality merged, though. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, this is a proposal for adding the functionality to load user overrides from a gettext po file rather than specifying them explicitly in the config file.
In the current draft, this adds the following options to the plugin config:
where
po_diris the directory path relative to the directory containing the config file where the po files are located, andoverrideis an array of config keys to override.For each configured language it looks for a file
<locale>.po(i.e.en.po) inpo_dir, reads the original value of the elements specified inoverrideand tries to find a translation for them in the po file (msgid = original config value). If found, the translation is used as override value.Corresponding directory structure:
If an explicit override is configured for the language, the explicit one takes precedence.
Rationale
I'm using mkdocs to construct a system for building "operating manuals" for special-purpose machinery, which has to be handed out in the manufacturers language ("original"), but as well in the national language of the country where it is deployed ("translation") and which has to be clearly marked as translation.
The idea is to have a "template" repository which is forked for each new project so that the people doing documentation have as few contact with the inner works of the project structure and build system as possible.
Translation is to be done half-automatically, using a similar approach like mkdocs-mdpo-plugin but purpose built (currently not a mkdocs plugin), which then generates the translated sources from po-files previously extracted from the default language files.
Loading the overrides from the po files allows me to
site_name, which is content in my opinion, out of the configurationToDo
This is still in a draft state which currently works for my special purpose, but propably needs some edge case testing and polishing for general useability. If you're interested in merging, I'll try to invest some more time to add tests, proper docs, etc.