# 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
                    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))

                    else:
                        #merge existing translation with the new one
                        msg = self.msgmerge(locale_file, polibext.po_to_unicode(po_form).encode('utf-8'))
                        if msg:
                            if len(po_form):
                                # add the new entries to the po file
                                with codecs.open(locale_file, 'a', 'utf-8') as fp:
                                    for entry in po_form: # this avoids printing the header
                                        fp.write(u"\n")
                                        fp.write(polibext.po_to_unicode(entry))

                                # filter away duplicates
                                msg = self.msguniq(locale_file)
                                # save entire po file once more and overwrite with filtered shizzle
                                with open(locale_file, 'w') as fp:
                                    fp.write(msg)


    def poify(self, model):
        """turn a django model into a po file."""
        if not hasattr(model, 'localized_fields'):
            return None

        # create po stream with header

# 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

                    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))

                    else:
                        #merge existing translation with the new one
                        msg = self.msgmerge(locale_file, polibext.po_to_unicode(po_form).encode('utf-8'))
                        if msg:
                            if len(po_form):
                                # add the new entries to the po file
                                with codecs.open(locale_file, 'a', 'utf-8') as fp:
                                    for entry in po_form: # this avoids printing the header
                                        fp.write(u"\n")
                                        fp.write(polibext.po_to_unicode(entry))

                                # filter away duplicates
                                msg = self.msguniq(locale_file)
                                # save entire po file once more and overwrite with filtered shizzle
                                with open(locale_file, 'w') as fp:
                                    fp.write(msg)


    def poify(self, model):
        """turn a django model into a po file."""
        if not hasattr(model, 'localized_fields'):
            return None

        # create po stream with header

        po_stream = polibext.PoStream(StringIO.StringIO(self.po_header)).parse()