# Path: core/models.py
# class Language(models.Model):
# 
#     long_name = models.CharField(max_length=255, blank=True, null=True)
#     short_name = models.CharField(max_length=30)
# 
#     def __unicode__(self):
#         return "%s (%s)" % (self.long_name, self.short_name) if self.long_name else self.short_name
# 
# class Package(models.Model):
# 
#     name = models.CharField(max_length=255)
#     src_url = models.URLField(blank=True, null=True)
# 
#     def __unicode__(self):
#         return self.name
# 
#     @property
#     def languages(self):
#         languages = Translation.objects.filter(package=self).values(
#             'language').distinct()
#         return Language.objects.filter(id__in=languages).order_by('long_name')
# 
#     @property
#     def translations(self):
#         return self.translation_set.all()
# 
#     @property
#     def translations_by_language(self):
#         return [(l, Translation.objects.filter(package=self,
#                 language=l).count()) for l in self.languages]
# 
#     def get_absolute_url(self):
#         return reverse('package_detail', args=[self.name])
# 
# class Translation(models.Model):
# 
#     msgstr = models.TextField(max_length=1000)
#     obsolete = models.BooleanField(default=False)
# 
#     #created = models.DateField(auto_now_add=True)
#     #last_modified = models.DateField(auto_now=True)
# 
#     language = models.ForeignKey(Language, db_index=True)
#     package = models.ForeignKey(Package, db_index=True)
#     sentence = models.ForeignKey(Sentence, db_index=True)
# 
#     def __unicode__(self):
#         return self.msgstr


from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.views.decorators.csrf import csrf_exempt
from core.models import Language, Package, Translation
    registered languages.

    Keys:
        long_name -- Full name (e.g., Brazilian Portuguese, English, French)
        short_name -- Abbreviated name (e.g., pt_BR, en, fr)

    """
    languages = []
    for language in Language.objects.all():
        languages.append({
            'long_name': language.long_name or '',
            'short_name': language.short_name,
        })

    return languages

def get_translation(language, term):
    """
    Arguments:
        language -- Translated term language.
        term -- Term to translate.

    Keys of the structure returned:
        original -- The original untranslated message.
        translation -- Translated term.
        packages -- Packages that contain the original message.

    """
    result = []


# Path: core/models.py
# class Language(models.Model):
# 
#     long_name = models.CharField(max_length=255, blank=True, null=True)
#     short_name = models.CharField(max_length=30)
# 
#     def __unicode__(self):
#         return "%s (%s)" % (self.long_name, self.short_name) if self.long_name else self.short_name
# 
# class Package(models.Model):
# 
#     name = models.CharField(max_length=255)
#     src_url = models.URLField(blank=True, null=True)
# 
#     def __unicode__(self):
#         return self.name
# 
#     @property
#     def languages(self):
#         languages = Translation.objects.filter(package=self).values(
#             'language').distinct()
#         return Language.objects.filter(id__in=languages).order_by('long_name')
# 
#     @property
#     def translations(self):
#         return self.translation_set.all()
# 
#     @property
#     def translations_by_language(self):
#         return [(l, Translation.objects.filter(package=self,
#                 language=l).count()) for l in self.languages]
# 
#     def get_absolute_url(self):
#         return reverse('package_detail', args=[self.name])
# 
# class Translation(models.Model):
# 
#     msgstr = models.TextField(max_length=1000)
#     obsolete = models.BooleanField(default=False)
# 
#     #created = models.DateField(auto_now_add=True)
#     #last_modified = models.DateField(auto_now=True)
# 
#     language = models.ForeignKey(Language, db_index=True)
#     package = models.ForeignKey(Package, db_index=True)
#     sentence = models.ForeignKey(Sentence, db_index=True)
# 
#     def __unicode__(self):
#         return self.msgstr


# Path: rpc_service/views.py
from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response
from django.views.decorators.csrf import csrf_exempt
from core.models import Language, Package, Translation

    registered languages.

    Keys:
        long_name -- Full name (e.g., Brazilian Portuguese, English, French)
        short_name -- Abbreviated name (e.g., pt_BR, en, fr)

    """
    languages = []
    for language in Language.objects.all():
        languages.append({
            'long_name': language.long_name or '',
            'short_name': language.short_name,
        })

    return languages

def get_translation(language, term):
    """
    Arguments:
        language -- Translated term language.
        term -- Term to translate.

    Keys of the structure returned:
        original -- The original untranslated message.
        translation -- Translated term.
        packages -- Packages that contain the original message.

    """
    result = []


    translations = Translation.objects.filter(