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

Incompatibility between mkdocs-git-revision-date-localized-plugin>=1.4.0 and mkdocs-static-i18n #176

Open
SimonSAMPERE opened this issue Mar 17, 2025 · 0 comments

Comments

@SimonSAMPERE
Copy link

I don't know if it's link to #86 but I have an MkDocs project using mkdocs-git-revision-date-localized-plugin and mkdocs-static-i18n. To support Brazilian Portuguese I have a folder doc/pt-BR and since 1.4.0 of mkdocs-git-revision-date-localized-plugin an error is raised trying to build (or serve loccaly) my project : ERROR - Error reading page 'pt-BR/index.md': expected only letters, got 'pt-br'

Full info below :

INFO    -  Building documentation...
INFO    -  mkdocs_static_i18n: Building 'fr' documentation to directory: %userprofile%\AppData\Local\Temp\mkdocs_ujfattiv
INFO    -  mkdocs_static_i18n: Adding 'fr' to the 'material/search' plugin 'lang' option
INFO    -  mkdocs_static_i18n: Adding 'es' to the 'material/search' plugin 'lang' option
INFO    -  mkdocs_static_i18n: Overriding 'fr' config 'site_name' with 'Plugin QGIS'
INFO    -  Cleaning site directory
INFO    -  mkdocs_static_i18n: Translated 27 navigation elements to 'fr'
INFO    -  mkdocs_static_i18n: Building 'en' documentation to directory: %userprofile%\AppData\Local\Temp\mkdocs_ujfattiv\en
INFO    -  mkdocs_static_i18n: Overriding 'en' config 'site_name' with 'QGIS Plugin'
INFO    -  mkdocs_static_i18n: Building 'fr' documentation to directory: %userprofile%\AppData\Local\Temp\mkdocs_ujfattiv
INFO    -  mkdocs_static_i18n: Overriding 'fr' config 'site_name' with 'Plugin QGIS'
INFO    -  mkdocs_static_i18n: Translated 27 navigation elements to 'fr'
INFO    -  mkdocs_static_i18n: Building 'es' documentation to directory: %userprofile%\AppData\Local\Temp\mkdocs_ujfattiv\es
INFO    -  mkdocs_static_i18n: Overriding 'es' config 'site_name' with 'Complemento QGIS'
INFO    -  mkdocs_static_i18n: Translated 27 navigation elements to 'es'
INFO    -  mkdocs_static_i18n: Building 'pt-BR' documentation to directory: %userprofile%\AppData\Local\Temp\mkdocs_ujfattiv\pt-BR
INFO    -  mkdocs_static_i18n: Language 'pt-BR' is not supported by lunr.js, not setting it in the 'plugins.search.lang' option
INFO    -  mkdocs_static_i18n: Overriding 'pt-BR' config 'site_name' with 'Complemento QGIS'
INFO    -  mkdocs_static_i18n: Translated 27 navigation elements to 'pt-BR'
ERROR   -  Error reading page 'pt-BR/index.md': expected only letters, got 'pt-br'
Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\Scripts\mkdocs.exe\__main__.py", line 7, in <module>
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs\__main__.py", line 272, in serve_command
    serve.serve(**kwargs)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs\commands\serve.py", line 85, in serve
    builder(config)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs\commands\serve.py", line 67, in builder
    build(config, serve_url=None if is_clean else serve_url, dirty=is_dirty)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs\commands\build.py", line 347, in build
    config.plugins.on_post_build(config=config)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs\plugins.py", line 602, in on_post_build
    return self.run_event('post_build', config=config)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs\plugins.py", line 568, in run_event
    result = method(**kwargs)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs_static_i18n\plugin.py", line 253, in on_post_build
    build(config, dirty=dirty)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs\commands\build.py", line 310, in build
    _populate_page(file.page, config, files, dirty)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs\commands\build.py", line 163, in _populate_page
    page.markdown = config.plugins.on_page_markdown(
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs\plugins.py", line 635, in on_page_markdown
    return self.run_event('page_markdown', markdown, page=page, config=config, files=files)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs\plugins.py", line 566, in run_event
    result = method(item, **kwargs)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs_git_revision_date_localized_plugin\plugin.py", line 245, in on_page_markdown
    revision_dates = self.util.get_date_formats_for_timestamp(
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs_git_revision_date_localized_plugin\util.py", line 216, in get_date_formats_for_timestamp
    date_formats = get_date_formats(
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\mkdocs_git_revision_date_localized_plugin\dates.py", line 29, in get_date_formats
    "date": format_date(loc_revision_date, format="long", locale=locale),
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\babel\dates.py", line 681, in format_date
    locale = Locale.parse(locale)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\babel\core.py", line 334, in parse
    parts = parse_locale(identifier, sep=sep)
  File "%userprofile%\Documents\GitHub\doc\doc-plugin-qgis\.venv\lib\site-packages\babel\core.py", line 1246, in parse_locale
    raise ValueError(f"expected only letters, got {lang!r}")
ValueError: expected only letters, got 'pt-br'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant