Comment 13 for bug 128496

Revision history for this message
Martin von Gagern (gagern) wrote :

I found out that bzr contains quite a bit of code dedicated to locale issues. There is even a test suite, blackbox.test_locale, dealing with this. However, bzr seems to do things in a pythonish way, using tools provided by the python library. And those functions seem to be designed to touch the current locale setting as little as possible, but rather relies on corresponding environment settings. I can think of three possible approaches:

1. Have bzr-svn wrap all its access to libsvn in a function temporarily setting the environment according to environment settings.
+ No modifications to bzr at large
- Might need to be replicated for other applications as well
- If another application which imports bzr called setlocale, that setting gets ignored

2. Have bzr call setlocale on a global level if it is run as an application. Leave everything else alone. That's the current approach of my setlocale branch.
+ Consistent locale-aware behaviour for all plugins
+ Locale-specific formatting fo dates and so on
- I guess the python functions still use environment settings over this locale, so behaviour remains inconsistent if imported in an application that did setlocale but did not modify the environment

3. Try to make Python-specific functions honour locale as set by setlocale. I haven't tried any of this, but I guess this would require determining locale settings and adjusting the environment accordingly.
+ Consistent behaviour even when imported in another application
- Maybe less locale support when run from within a non-locale aware application
- Modifying the environment when run inside an application might be a bad idea

Any input from people with more knowledge about Python and locales highy appreciated.