Django translation and py2exe
Edit: I post here code lines, where I'm trying import translation util:
'django.utils.translation.*',
'django.conf.locale.pl.*',
I have also tried:
'django.utils.translation.trans_null',
'django.utils.translation.trans_real',
'django.utils.translation.__init__',
'django.conf.locale.pl.__init__',
'django.conf.locale.pl.formats',
But as I had though it doesn't matter. In build\bdist.win-amd64\winexe\collect-2.7\django there are both folders conf/locale and utils/translation with proper files. But of course not LC_MESSAGE folder. I try to import it using:
py2exe_data_files += add_path_tree( python_path, 'lib\site-packages\django\conf\locale\pl' )
As I checked it finds files in this folder but do nothing with them.
My setup file (it's long so I put it on the sourcepod): http://www.sourcepod.com/fcmpkn17-5519
Maybe I forgot to include something but I don't have any idea what could it be..
Finally solved! And in so easy way..
As https://docs.djangoproject.com/en/dev/topics/i18n/deployment/ says we can put locale files into different localizations. So I copy all locale files from django/conf to my template folder.
This line of my py2exe setup.py copy it to my compilation with templates:
py2exe_data_files += add_path_tree( '', 'templates' )
The last thing to do is to set locale path in settings file:
LOCALE_PATHS = (
'templates/locale',
)
精彩评论