# Path: easymode/utils/languagecode.py
# def get_language_codes():
#     """
#     Retrieves all the language codes defined in ``settings.LANGUAGES``.
#     
#     >>> settings.LANGUAGES = (('en','English'),('de','German'),('nl-be','Belgium dutch'),('fr-be','Belgium french'),)
#     >>> sorted( get_language_codes() )
#     ['de', 'en', 'fr-be', 'nl-be']
#     
#     :rtype: A :class:`list` of language codes.
#     """
#     return dict(settings.LANGUAGES).keys()
# 
# Path: easymode/utils/polibext.py
# def po_to_unicode(po_obj):
#     def __init__(self, stream, fpath=None, encoding='utf-8', wrapwidth=78):
# class PoStream(polib._POFileParser):


import os
import re
import subprocess
import codecs
import logging
import StringIO
import unicodedata
import easymode.tree.introspection
    import polib
from datetime import datetime
from django.conf import settings
from django.core.management.base import CommandError
from django.core.exceptions import ImproperlyConfigured
from django.utils.translation import templatize, to_locale, get_language
    from django.utils.timezone import tzinfo
    from django.utils import tzinfo
from django.template.loader import render_to_string
from easymode.utils import mutex
from easymode.utils.languagecode import get_language_codes
from easymode.utils import polibext
            return

        if hasattr(instance, 'language') and instance.language != settings.LANGUAGE_CODE:
            return

        if get_language() != settings.LANGUAGE_CODE:
            return

        po_form = self.poify(instance)
        if po_form is not None:
            # for each language create a po file
            for language in get_language_codes():

                locale_dir = os.path.join( self.location , 'locale',
                    to_locale(language), 'LC_MESSAGES')
                locale_file = os.path.join( locale_dir, 'django.po')

                # create locale dir if not available
                if not os.path.isdir(locale_dir):
                    os.makedirs(locale_dir)

                # acquire exclusive lock this should only be run
                # by one process at a time
                with mutex(max_wait=30):
                    # write proper header if the file is new
                    # this header contains the character set.
                    write_header = not os.path.exists(locale_file)

                    if write_header: # write header and po stuffz0r
                        with codecs.open(locale_file, 'w', 'utf-8') as fp:

# Path: easymode/utils/languagecode.py
# def get_language_codes():
#     """
#     Retrieves all the language codes defined in ``settings.LANGUAGES``.
#     
#     >>> settings.LANGUAGES = (('en','English'),('de','German'),('nl-be','Belgium dutch'),('fr-be','Belgium french'),)
#     >>> sorted( get_language_codes() )
#     ['de', 'en', 'fr-be', 'nl-be']
#     
#     :rtype: A :class:`list` of language codes.
#     """
#     return dict(settings.LANGUAGES).keys()
# 
# Path: easymode/utils/polibext.py
# def po_to_unicode(po_obj):
#     def __init__(self, stream, fpath=None, encoding='utf-8', wrapwidth=78):
# class PoStream(polib._POFileParser):


# Path: easymode/i18n/gettext.py
import os
import re
import subprocess
import codecs
import logging
import StringIO
import unicodedata
import easymode.tree.introspection
    import polib
from datetime import datetime
from django.conf import settings
from django.core.management.base import CommandError
from django.core.exceptions import ImproperlyConfigured
from django.utils.translation import templatize, to_locale, get_language
    from django.utils.timezone import tzinfo
    from django.utils import tzinfo
from django.template.loader import render_to_string
from easymode.utils import mutex
from easymode.utils.languagecode import get_language_codes
from easymode.utils import polibext

            return

        if hasattr(instance, 'language') and instance.language != settings.LANGUAGE_CODE:
            return

        if get_language() != settings.LANGUAGE_CODE:
            return

        po_form = self.poify(instance)
        if po_form is not None:
            # for each language create a po file
            for language in get_language_codes():

                locale_dir = os.path.join( self.location , 'locale',
                    to_locale(language), 'LC_MESSAGES')
                locale_file = os.path.join( locale_dir, 'django.po')

                # create locale dir if not available
                if not os.path.isdir(locale_dir):
                    os.makedirs(locale_dir)

                # acquire exclusive lock this should only be run
                # by one process at a time
                with mutex(max_wait=30):
                    # write proper header if the file is new
                    # this header contains the character set.
                    write_header = not os.path.exists(locale_file)

                    if write_header: # write header and po stuffz0r
                        with codecs.open(locale_file, 'w', 'utf-8') as fp:

                            fp.write(polibext.po_to_unicode(po_form))