Skip to content

Commit

Permalink
remove py37 fstrings and fix locales
Browse files Browse the repository at this point in the history
  • Loading branch information
timvink committed Dec 16, 2019
1 parent 867307f commit e21d34e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions mkdocs_git_revision_date_localized_plugin/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,22 @@ def __init__(self):
def on_config(self, config):

# Get locale settings
mkdocs_locale = config.get('locale')
mkdocs_locale = self.config.get('locale')
plugin_locale = self.config['locale']
theme_locale = vars(config['theme']).get('_vars', {}).get('locale')
theme_locale = vars(self.config['theme']).get('_vars', {}).get('locale')
if theme_locale is None:
theme_locale = vars(config['theme']).get('_vars', {}).get('language')
theme_locale = vars(self.config['theme']).get('_vars', {}).get('language')

# First prio: plugin locale
if plugin_locale != '':
if plugin_locale != mkdocs_locale:
print(f"WARNING - plugin locale setting '{plugin_locale}' will overwrite mkdocs locale '{mkdocs_locale}'")
self.locale = mkdocs_locale
self.locale = plugin_locale
return

# Second prio: theme
if theme_locale:
self.locale = theme_locale
# Third is mkdocs locale setting (might be add in the future)

# Third is mkdocs locale setting (might be added in the future)
if mkdocs_locale:
self.locale = mkdocs_locale

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='mkdocs-git-revision-date-localized-plugin',
version='0.3.3',
version='0.4',
description='Mkdocs plugin that enables displaying the localized date of the last git modification of a markdown file.',
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit e21d34e

Please sign in to comment.