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

Post date formats, sphinx/ablog config and locale #224

Open
kielbasi opened this issue May 4, 2023 · 1 comment
Open

Post date formats, sphinx/ablog config and locale #224

kielbasi opened this issue May 4, 2023 · 1 comment

Comments

@kielbasi
Copy link

kielbasi commented May 4, 2023

Describe the bug

Hi !

Many thanks for the work on ablog. I am developing a website with sphinx and pydata theme and I use ablog to manage events data as posts with comments disabled.

I had an unexpected behaviour but I don't know if it concerns directly ablog or sphinx itself. Indeed, setting language, blog_languages and blog_default_language options to 'en' properly as shown in sphinx and ablog documentation, dates visible in the result of a postlist directive are still in French. Why in French ? Because of the locale of my computer. Then, in addition to these 3 options, I had to set the locale to en_GB in the conf.py file directly to fix the problem. I don't think this unexpected behaviour is linked to another sphinx extension used, but I attach the relevant part of my conf.py to explain them.

By using %b, %B, %a and/or %A in the :date: parameter of a postlist directive, the printed words are in French if we comment the line setting the locale.

It is a bug of blog_languages and blog_default_language options ? or language option itself ?

Thanks in advance.

To Reproduce

Configuration file for the Sphinx documentation builder.

For the full list of built-in configuration values, see the documentation:

https://www.sphinx-doc.org/en/master/usage/configuration.html

import os
import sys
import locale
import datetime

we have to set the locale to en_GB for date prints

locale.setlocale(locale.LC_ALL, "en_GB")

-- Project information -----------------------------------------------------

https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

...

-- General configuration ---------------------------------------------------

https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = ["breathe",
"sphinx_copybutton",
"sphinx_design",
"sphinx_subfigure",
"sphinxcontrib.email",
"sphinxcontrib.moderncmakedomain",
"ablog",
"sphinx.ext.intersphinx"]

language = "en"
templates_path = ["_templates"]
exclude_patterns = []

breathe configuration

...

sphinx_copybutton configuration

...

sphinxcontrib-email configuration

email_automode = True

ablog configuration

blog_path = "events"
blog_title = "Events"
blog_languages = {
"en": ("English", None),
}
blog_default_language = "en"
fontawesome_included = True

-- Options for HTML output -------------------------------------------------

https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "pydata_sphinx_theme"
html_static_path = ["_static"]

...

Screenshots

No response

System Details

masOS Ventura, intel
every sphinx and ablog dependency installed with pip and up to date

Installation method

pip

@nabobalis
Copy link
Contributor

Thanks for the report, I will try to look into it.

I am planning on removing the shear number of language options from ablog and let sphinx deal with it in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants