config.load_langs_on_demand: permits on-the-fly loading/unloading, to facilitate proc-gen use cases #158
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.
This branch (squash pls) adds
config.py
(eventually #128) with one variable:load_langs_on_demand
.When this variable is
True
, the localized function caller will - if and only if a language is passed which is not loaded - load the language, call the function, and unload the language.At the moment, this is pretty fast, though it might need to be revisited if some languages become truly bloated with resource files.
This is only desirable in certain use cases, but, for instance, the absence of this flag was an obstacle for @JarbasAl's modular
text2speech
package, which doesn't always know the language it wants ahead of time.I've tested this PR against that module, and it solves the problem. I want to stress that use cases like Mycroft, which prefer to utilize at most one engine per language, will not want to set this flag.