vilardellsalles / vilardellsalles.github.io

Personal web page
0 stars 0 forks source link

Invalid months in Catalan #10

Open vilardellsalles opened 2 years ago

vilardellsalles commented 2 years ago

When representing dates in Catalan, the format datetime.strftime("%d %B") method produces output like 23 octubre, but it should be 23 d'octubre. This cannot be replaced by "%d d'%B" format because the proper format for months starting with a consonant is different (e.g., 23 de novembre). Therefore, it should be investigated how to solve this issue. So far, this has been solved by using the sphinx.util.i18n.format_date method that basically uses the babel.dates module to format dates, but it is unclear how Babel implements this and how this could be ported to the standard library (i.e., to datetime). There is a possible solution at Softcatalà.

vilardellsalles commented 8 months ago

As explained in the documentation, Babel implements its own syntax for date and time, independent of datetime.strftime. sphinx.util.i18n.format_date basically translates datetime.strftime syntax to babel.dates syntax.

vilardellsalles commented 8 months ago

According to Softcatalà and the C standard library specification (used in Python), the syntax datetime.strftime("%-d %B") could be used to produce the desired output, but this does not seem to work with Python 3.12.1 and Clang 13.0.0 on darwin. However, it does work with Python 3.6.9 and GCC 8.4.0 on linux.