slashmili / python-jalali

Jalali calendar binding for Python based on Python's datetime module
http://pypi.python.org/pypi/jdatetime/
Other
339 stars 48 forks source link

to specify format language manually #24

Closed khafan246 closed 8 years ago

khafan246 commented 8 years ago

currently, the strftime depends on getdefaultlocale for language detection. but this will not cover many use cases. it would be good to be able to specify it manually.

slashmili commented 8 years ago

The idea is to keep the datetime module function as they are in standard library.

Why don't you use locale to change the language?

khafan246 commented 8 years ago

I don't get your point, changing locale will not affect the output:

>>> import jdatetime
>>> print(print(jdatetime.datetime.now().strftime("%a, %d %b %Y %H:%M:%S")))
Yek, 05 Ord 1395 21:39:58
>>> import locale
>>> locale.setlocale(locale.LC_TIME, "fa_IR")
'fa_IR'
>>> print(print(jdatetime.datetime.now().strftime("%a, %d %b %Y %H:%M:%S")))
Yek, 05 Ord 1395 21:40:14