You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2019-09-19.05:27:39.350>created_at=<Date2019-09-18.21:03:06.324>labels= ['3.7', 'type-bug', 'library']
title='Wrong values for %b and %B in ca_ES and ca_AD locales'updated_at=<Date2019-09-19.05:27:39.340>user='https://bugs.python.org/aseques'
%b Month as locale’s abbreviated name. Jan, Feb, …, Dec (en_US)
%B Month as locale’s full name. January, February, …, December (en_US);
It works also in es_ES an others, while in catalan there's an extra article on the month name (and a point in the abbreviated version) that shouldn't be there de "set." and "de setembre".
Where should I go to fix this and get the documented behaviour? I haven't been able to find a translation section on python site.
importlocalefromdatetimeimportdatetimelocale.setlocale(locale.LC_ALL, 'ca_AD.utf8')
locale.setlocale(locale.LC_ALL, 'ca_ES.utf8')
#locale.setlocale(locale.LC_ALL, 'es_ES.utf8')now=datetime.now() # current date and timedate_time=now.strftime("|%b|%B|")
print("date and time:",date_time)
The result from strftime is platform dependent. In Windows, the result has a trailing "." for the abbreviated names that are less than four characters, but no "de" in either form:
>>> months = [(2019, m) + (0,)*7 for m in range(1,13)]
>>> locale.setlocale(locale.LC_ALL, 'ca_ES.utf8')
'ca_ES.utf8'
>>> print(*(time.strftime('%b|%B', m) for m in months), sep='\n')
gen.|gener
febr.|febrer
març|març
abr.|abril
maig|maig
juny|juny
jul.|juliol
ag.|agost
set.|setembre
oct.|octubre
nov.|novembre
des.|desembre
In Linux, the result uses the same base abbreviations as in Windows, including the trailing ".", but it also includes "de" or "d'" in both forms:
>>> months = [(2019, m) + (0,)*7 for m in range(1,13)]
>>> locale.setlocale(locale.LC_ALL, 'ca_ES.utf8')
'ca_ES.utf8'
>>> print(*(time.strftime('%b|%B', m) for m in months), sep='\n')
de gen.|de gener
de febr.|de febrer
de març|de març
d’abr.|d’abril
de maig|de maig
de juny|de juny
de jul.|de juliol
d’ag.|d’agost
de set.|de setembre
d’oct.|d’octubre
de nov.|de novembre
de des.|de desembre
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: