Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup our own translator without override the existing one #42

Merged
merged 3 commits into from
Apr 7, 2020

Conversation

humitos
Copy link
Member

@humitos humitos commented Apr 4, 2020

Instead of fully override the translator set by the user (or another
Sphinx extension), we create a new class dynamically by inheriting the
translator that's defined and adding our own Mixin class with our
custom behavior.

This way, we are compatible with other extensions nicely.

As a example, I tested this with
pydata-sphinx-theme (https://github.com/pandas-dev/pydata-sphinx-theme)
that defines a custom translator.

Besides, this new approach is compatible with people using HTML5
translator by default since we are not forcing HTML4 when inheriting
our own custom class anymore.

This is related to #14

@humitos humitos added the Improvement Minor improvement to code label Apr 4, 2020
@humitos humitos requested a review from a team April 4, 2020 17:38
@humitos humitos force-pushed the humitos/setup-translators branch from 07e659f to 8563b2a Compare April 4, 2020 18:06
Instead of fully override the translator set by the user (or another
Sphinx extension), we create a new class dynamically by inheriting the
translator that's defined and adding our own Mixin class with our
custom behavior.

This way, we are compatible with other extensions nicely.

As a example, I tested this with
pydata-sphinx-theme (https://github.com/pandas-dev/pydata-sphinx-theme)
that defines a custom translator.

Besides, this new approach is compatible with people using HTML5
translator by default since we are not forcing HTML4 when inheriting
our own custom class anymore.
Copy link
Member

@ericholscher ericholscher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 with the change

@humitos humitos merged commit 586893f into master Apr 7, 2020
@humitos humitos deleted the humitos/setup-translators branch April 7, 2020 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Improvement Minor improvement to code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants