slashmili / python-jalali

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

changing locale in python 3 #70

Closed hamedf62 closed 3 years ago

hamedf62 commented 4 years ago

hi @yassersouri thank you for the great module!

unfortunately in python3 even when changing local to FA the result returned in english.

any advise?

farzadghanei commented 4 years ago

@hamedf62 could you please share a code snippet of the mentioned issue, and make it clear how the output is different than the expectation?

Also please include your runtime information (system, exact Python version and jdatetime version).

hamedf62 commented 4 years ago

thank you @farzadghanei

Python 3.7.7 (tags/v3.7.7:d7c567b08f, Mar 10 2020, 10:41:24) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import locale import jdatetime locale.setlocale(locale.LC_ALL, "fa_IR") 'fa_IR' jdatetime.datetime.now().strftime("%a, %d %b %Y %H:%M:%S") 'Thu, 30 Mor 1399 11:26:38'

i expected it returns in unicode in Farsi

Name: jdatetime Version: 3.6.2 Summary: Jalali datetime binding for python Home-page: https://github.com/slashmili/python-jalali License: Python Software Foundation License Requires: Required-by:

Python 3.7.7

slashmili commented 4 years ago

@hamedf62 Hi 👋

That's strange, the test passes in python 3.7(win).

Could you clone the repo and run the unit test in your machine and give me the output?

git clone <repo>
cd <repo>
python.exe t/test.py
hamedf62 commented 3 years ago

@hamedf62 Hi 👋

That's strange, the test passes in python 3.7(win).

Could you clone the repo and run the unit test in your machine and give me the output?

git clone <repo>
cd <repo>
python.exe t/test.py

@slashmili greetings! miss you for long time... wish all going well with you!

actually you right and all related to my locale to get Farsi charachters. all working perfectly with Jdatetime

also there is another issue with converting two digit year to jdatetime format. kindly check below script:

jdatetime.datetime.strptime('99',"%y")

it return ValueError.

have fun

slashmili commented 3 years ago

@hamedf62 Prefect!

As for the strptime problem, could please open another issue.