Proposal for support of multiple languages #3
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 pull request is the beginning of the work for addressing issue #2.
The idea is to create some submodules that deal each one with a given language (see for example in the pull request the subdirectories
en
andit
inwikiciteparser
) where the language-depended functions and/or data should be added.In particular in this pull request the
__init__.py
files for the submodulesen
andit
both contain the definition of the citation template names that are supported within the setcitation_template_names
. The content of__init__.py
is executed when the module is imported.The submodules should contain all the code that is language specific, then you can use dynamic import like this:
where
lang
is a string with a specific language code (e.g.en
,it
)To support new languages one just need to create another subdirectory (e.g.
es
,de
, etc.) and implement a list of needed function. For now, you just need to define the setcitation_template_names
Do you think that this design could work for this library? Do you have any comments?
I should add also some test for itwiki templates.