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

WIP locale fix #136

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open

WIP locale fix #136

wants to merge 1 commit into from

Conversation

InFog
Copy link
Contributor

@InFog InFog commented Oct 27, 2015

Hello, @turicas.

This is not a final PR, it is still a work in progress.

So, the thing is that I get some errors when running the tests on my machine and it looks like it is because I'm missing the pt_BR.UTF-8 locale.

As you can see in tests/tests_fields.py I am importing the locale module to find out the current locale and the decimal point and thousand separator. Then I'm using those values to format the numbers for the tests.

I also had to add the locale to the DecimalField class, because it was looking for thousand separator considering only dots, not commas.

Still, my tests are not passing because of those small differences when formatting numbers.

Oh, I also added one missing requirement to the development requirements: openpyxl

Can you please have a look and tell if I'm going in the right direction here? Maybe you have some concerns about the way I'm getting the current locale or something. I'm not a Python developer all the time, so I may be missing something :|

Thanks!

@InFog
Copy link
Contributor Author

InFog commented Nov 8, 2015

Hey, @turicas, any news here? Do you think I should go this way?

@turicas
Copy link
Owner

turicas commented Nov 13, 2015

@InFog, thanks for your PR and sorry for the delay to answer!

I'd prefer to do not use localeconv() directly because of the rows.locale_context context manager.
The tests really need pt_BR locale to run and I don't think there's another way to change it (unless we don't use locale at all). I think we need to discuss more the problem of using locale (the babel may help here).
In which direction are you feeling to go to? Do you have any ideas on this?

@InFog
Copy link
Contributor Author

InFog commented Nov 27, 2015

I think a good way to solve this issue would be checking what other projects are doing to handle locales. Having the tests depending on one specific locale is not a good idea, in my opinion.

Maybe we could abstract the locale detection and try to use some different locale detection approaches.

Still, the first step would be to get rid of locale dependency to run the tests ;)

@turicas turicas force-pushed the develop branch 2 times, most recently from fa144f0 to bbb2c57 Compare November 30, 2018 01:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants