コード例 #1
0
ファイル: initdb.py プロジェクト: DronRathore/pootle
def create_default_projects():
    """Create the default projects that we host.

    You might want to add your projects here, although you can also add things
    through the web interface later.
    """
    from pootle_app.management import require_english
    from pootle_project.models import Project

    en = require_english()

    #pootle = Project(code=u"pootle", source_language=en)
    #pootle.fullname = u"Pootle"
    #pootle.description = ('<div dir="ltr" lang="en">Interface translations '
    #                      'for Pootle. <br /> See the <a href="http://'
    #                      'pootle.locamotion.org">official Pootle server</a> '
    #                      'for the translations of Pootle.</div>')
    #pootle.checkstyle = "standard"
    #pootle.localfiletype = "po"
    #pootle.treestyle = "auto"
    #pootle.save()

    tutorial = Project(code=u"tutorial", source_language=en)
    tutorial.fullname = u"Tutorial"
    tutorial.description = ('<div dir="ltr" lang="en">Tutorial project where '
                            'users can play with Pootle and learn more about '
                            'translation and localisation.<br />For more help '
                            'on localisation, visit the <a href="http://'
                            'translate.sourceforge.net/wiki/guide/start">'
                            'localisation guide</a>.</div>')
    tutorial.checkstyle = "standard"
    tutorial.localfiletype = "po"
    tutorial.treestyle = "auto"
    tutorial.save()
コード例 #2
0
ファイル: tests.py プロジェクト: AshishNamdev/verbatim
 def setUp(self):
     super(XliffTests, self).setUp()
     en = require_english()
     Project.objects.get_or_create(code="testproj", fullname=u"testproj",
                                   localfiletype=self.ext, source_language=en)
     self.project = Project.objects.get(code='testproj')
     for tp in self.project.translationproject_set.iterator():
         tp.require_units()
コード例 #3
0
ファイル: tests.py プロジェクト: itsjeyd/wikitrans-pootle
 def setUp(self):
     super(GnuTests, self).setUp()
     english = require_english()
     Project.objects.get_or_create(code="testproj", fullname=u"testproj",
                                   source_language=english)
     self.project = Project.objects.get(code='testproj')
     for trans_proj in self.project.translationproject_set.iterator():
         trans_proj.require_units()
コード例 #4
0
 def setUp(self):
     super(GnuTests, self).setUp()
     en = require_english()
     Project.objects.get_or_create(code="testproj",
                                   fullname=u"testproj",
                                   source_language=en)
     self.project = Project.objects.get(code='testproj')
     for tp in self.project.translationproject_set.iterator():
         tp.require_units()
コード例 #5
0
def import_projects(parsed_data):
    # This could prompt the user, asking:
    # "Want us to import projects? Say no if you have already 
    # added the projects to the new Pootle DB in the web UI."

    data = parsed_data.__root__._assignments # Is this really the right way?
    prefix = 'Pootle.projects.'

    # Filter out unrelated keys
    keys = [key for key in data if key.startswith(prefix)]

    # Clean up 'pootle.fullname' into 'pootle'
    projs = set([key[len(prefix):].split('.')[0] for key in keys]) 

    en = require_english()
    for proj in map(lambda s: unicode(s, 'utf-8'), projs):
        # id, for free
        # code:
        try:
            db_proj = Project.objects.get(code=proj)
            logging.log(logging.INFO,
                        'Already found a project named %s.\n'\
                        'Data for this project are not imported.',
                        proj)
            continue
        except Project.DoesNotExist:
            db_proj = Project(code=proj, source_language=en)

        # fullname
        db_proj.fullname = _get_attribute(data, proj, 'fullname', prefix=prefix)

        # description
        db_proj.description = _get_attribute(data, proj, 'description',
                                             prefix=prefix)

        # checkstyle
        db_proj.checkstyle = _get_attribute(data, proj, 'checkerstyle',
                                            unicode_me = False, prefix=prefix)

        # localfiletype
        db_proj.localfiletype = _get_attribute(data, proj, 'localfiletype',
                                               default='po', prefix=prefix)

        # treestyle
        db_proj.treestyle = _get_attribute(data, proj, 'treestyle',
                            unicode_me = False, default='auto', prefix=prefix)

        # ignoredfiles
        db_proj.ignoredfiles = _get_attribute(data, proj, 'ignoredfiles',
                               default=u'', prefix=prefix)

        logging.info("Creating project %s", db_proj)
        db_proj.save()
コード例 #6
0
def import_projects(parsed_data):
    # This could prompt the user, asking:
    # "Want us to import projects? Say no if you have already
    # added the projects to the new Pootle DB in the web UI."

    data = parsed_data.__root__._assignments # Is this really the right way?
    prefix = 'Pootle.projects.'

    # Filter out unrelated keys
    keys = [key for key in data if key.startswith(prefix)]

    # Clean up 'pootle.fullname' into 'pootle'
    projs = set([key[len(prefix):].split('.')[0] for key in keys])

    en = require_english()
    for proj in map(lambda s: unicode(s, 'utf-8'), projs):
        # id, for free
        # code:
        try:
            db_proj = Project.objects.get(code=proj)
            logging.log(logging.INFO,
                        'Already found a project named %s.\n'\
                        'Data for this project are not imported.',
                        proj)
            continue
        except Project.DoesNotExist:
            db_proj = Project(code=proj, source_language=en)

        # fullname
        db_proj.fullname = _get_attribute(data, proj, 'fullname', prefix=prefix)

        # description
        db_proj.description = _get_attribute(data, proj, 'description',
                                             prefix=prefix)

        # checkstyle
        db_proj.checkstyle = _get_attribute(data, proj, 'checkerstyle',
                                            unicode_me=False, prefix=prefix)

        # localfiletype
        db_proj.localfiletype = _get_attribute(data, proj, 'localfiletype',
                                               default='po', prefix=prefix)

        # treestyle
        db_proj.treestyle = _get_attribute(data, proj, 'treestyle',
                            unicode_me=False, default='auto', prefix=prefix)

        # ignoredfiles
        db_proj.ignoredfiles = _get_attribute(data, proj, 'ignoredfiles',
                               default=u'', prefix=prefix)

        logging.info("Creating project %s", db_proj)
        db_proj.save()
コード例 #7
0
def create_default_projects():
    """Create the default projects that we host.

    You might want to add your projects here, although you can also add things
    through the web interface later.
    """
    from pootle_app.management import require_english
    from pootle_project.models import Project

    en = require_english()

    #criteria = {
    #    'code': u"pootle",
    #    'source_language': en,
    #    'fullname': u"Pootle",
    #    'description': ('<div dir="ltr" lang="en">Interface translations for '
    #                    'Pootle.<br />See the <a href="http://'
    #                    'pootle.locamotion.org">official Pootle server</a> '
    #                    'for the translations of Pootle.</div>')
    #    'checkstyle': "standard",
    #    'localfiletype': "po",
    #    'treestyle': "auto",
    #}
    #pootle = Project(**criteria)
    #pootle.save()

    criteria = {
        'code':
        u"tutorial",
        'source_language':
        en,
        'fullname':
        u"Tutorial",
        'description': ('<div dir="ltr" lang="en">Tutorial project where '
                        'users can play with Pootle and learn more about '
                        'translation and localisation.<br />For more help on '
                        'localisation, visit the <a href="http://'
                        'translate.sourceforge.net/wiki/guide/start">'
                        'localisation guide</a>.</div>'),
        'checkstyle':
        "standard",
        'localfiletype':
        "po",
        'treestyle':
        "auto",
    }
    tutorial = Project(**criteria)
    tutorial.save()
コード例 #8
0
ファイル: initdb.py プロジェクト: niragInes/pootle
def create_default_projects():
    """Create the default projects that we host.

    You might want to add your projects here, although you can also add things
    through the web interface later.
    """
    from pootle_app.management import require_english
    from pootle_project.models import Project

    en = require_english()

    #criteria = {
    #    'code': u"pootle",
    #    'source_language': en,
    #    'fullname': u"Pootle",
    #    'description': ('<div dir="ltr" lang="en">Interface translations for '
    #                    'Pootle.<br />See the <a href="http://'
    #                    'pootle.locamotion.org">official Pootle server</a> '
    #                    'for the translations of Pootle.</div>')
    #    'checkstyle': "standard",
    #    'localfiletype': "po",
    #    'treestyle': "auto",
    #}
    #pootle = Project(**criteria)
    #pootle.save()

    criteria = {
        'code': u"tutorial",
        'source_language': en,
        'fullname': u"Tutorial",
        'description': ('<div dir="ltr" lang="en">Tutorial project where '
                        'users can play with Pootle and learn more about '
                        'translation and localisation.<br />For more help on '
                        'localisation, visit the <a href="http://'
                        'translate.sourceforge.net/wiki/guide/start">'
                        'localisation guide</a>.</div>'),
        'checkstyle': "standard",
        'localfiletype': "po",
        'treestyle': "auto",
    }
    tutorial = Project(**criteria)
    tutorial.save()
コード例 #9
0
ファイル: initdb.py プロジェクト: itsjeyd/wikitrans-pootle
def create_default_projects():
    """Create the default projects that we host. You might want to add your
    projects here, although you can also add things through the web interface
    later."""
    from pootle_project.models import Project
    from pootle_app.management import require_english

    en = require_english()

    tutorial = Project(code=u"tutorial", source_language=en)
    tutorial.fullname = u"Tutorial"
    tutorial.description = "<div dir='ltr' lang='en'>Tutorial project " \
                           "where users can play with Pootle and learn " \
                           "more about translation and localisation." \
                           "<br />For more help on localisation, visit " \
                           "the <a href='http://translate.sourceforge.net/" \
                           "wiki/guide/start'>localisation guide</a>.</div>"
    tutorial.checkstyle = "standard"
    tutorial.localfiletype = "po"
    tutorial.treestyle = "auto"
    tutorial.save()
コード例 #10
0
def create_default_projects():
    """Create the default projects that we host. You might want to add your
    projects here, although you can also add things through the web interface
    later."""
    from pootle_project.models import Project
    from pootle_app.management import require_english

    en = require_english()

    #pootle = Project(code=u"pootle", source_language=en)
    #pootle.fullname = u"Pootle"
    #pootle.description = "<div dir='ltr' lang='en'>Interface translations for Pootle. <br /> See the <a href='http://pootle.locamotion.org'>official Pootle server</a> for the translations of Pootle.</div>"
    #pootle.checkstyle = "standard"
    #pootle.localfiletype = "po"
    #pootle.treestyle = "auto"
    #pootle.save()

    tutorial = Project(code=u"tutorial", source_language=en)
    tutorial.fullname = u"Tutorial"
    tutorial.description = "<div dir='ltr' lang='en'>Tutorial project where users can play with Pootle and learn more about translation and localisation.<br />For more help on localisation, visit the <a href='http://translate.sourceforge.net/wiki/guide/start'>localisation guide</a>.</div>"
    tutorial.checkstyle = "standard"
    tutorial.localfiletype = "po"
    tutorial.treestyle = "auto"
    tutorial.save()