def lang_data(LANGUAGE_CODE, **kwargs):
    # These are needed for i18n
    from django.http import HttpRequest
    from django.views.i18n import javascript_catalog

    LANGUAGE_BIDI = LANGUAGE_CODE.split('-')[0] in \
        settings.LANGUAGES_BIDI

    request = HttpRequest()
    request.GET['language'] = LANGUAGE_CODE

    # Add some JavaScript data
    content = 'var LANGUAGE_CODE = "%s";\n' % LANGUAGE_CODE
    content += 'var LANGUAGE_BIDI = ' + \
        (LANGUAGE_BIDI and 'true' or 'false') + ';\n'
    content += javascript_catalog(request,
        packages=settings.INSTALLED_APPS).content

    # The hgettext() function just calls gettext() internally, but
    # it won't get indexed by makemessages.
    content += '\nwindow.hgettext = function(text) { return gettext(text); };\n'
    # Add a similar hngettext() function
    content += 'window.hngettext = function(singular, plural, count) { return ngettext(singular, plural, count); };\n'

    return content
示例#2
0
文件: views.py 项目: Mognom/wirecloud
def cached_javascript_catalog(request):
    packages = ['wirecloud.commons', 'wirecloud.catalogue', 'wirecloud.platform']

    for plugin in get_plugins():
        packages.append(plugin.__module__)

    return javascript_catalog(request, "djangojs", packages)
示例#3
0
    def i18n_javascript(self, request):
        if settings.USE_I18N:
            from django.views.i18n import javascript_catalog
        else:
            from django.views.i18n import null_javascript_catalog as javascript_catalog

        return javascript_catalog(request, domain='django', packages=['django_mptt_admin'])
示例#4
0
文件: base.py 项目: Aypak/ka-lite
def update_jsi18n_file(code="en"):
    """
    For efficieny's sake, we want to cache Django's
    js18n file.  So, generate that file here, then
    save to disk--it won't change until the next language pack update!
    """
    translation.activate(code)  # we switch the language of the whole thread
    output_dir = os.path.join(settings.CONTENT_ROOT, 'locale', 'js', 'i18n')
    ensure_dir(output_dir)
    output_file = os.path.join(output_dir, "%s.js" % code)

    request = HttpRequest()
    request.path = output_file
    request.session = {settings.LANGUAGE_COOKIE_NAME: code}

    response = javascript_catalog(request, packages=('ka-lite.locale',), domain="djangojs")
    icu_js = ""
    for path in settings.LOCALE_PATHS:
        try:
            icu_js = open(os.path.join(path, code, "%s_icu.js" % code), "r").read()
        except IOError:
            logging.warn("No {code}_icu.js file found in locale_path {path}".format(code=code, path=path))
    output_js = response.content + "\n" + icu_js
    logging.info("Writing i18nized js file to {0}".format(output_file))
    with open(output_file, "w") as fp:
        fp.write(output_js)
    translation.deactivate()
def lang_data(LANGUAGE_CODE, **kwargs):
    # These are needed for i18n
    from django.http import HttpRequest
    from django.views.i18n import javascript_catalog

    LANGUAGE_BIDI = LANGUAGE_CODE.split('-')[0] in \
        settings.LANGUAGES_BIDI

    request = HttpRequest()
    request.GET['language'] = LANGUAGE_CODE

    # Add some JavaScript data
    content = 'var LANGUAGE_CODE = "%s";\n' % LANGUAGE_CODE
    content += 'var LANGUAGE_BIDI = ' + \
        (LANGUAGE_BIDI and 'true' or 'false') + ';\n'
    content += javascript_catalog(request,
                                  packages=settings.INSTALLED_APPS).content

    # The hgettext() function just calls gettext() internally, but
    # it won't get indexed by makemessages.
    content += '\nwindow.hgettext = function(text) { return gettext(text); };\n'
    # Add a similar hngettext() function
    content += 'window.hngettext = function(singular, plural, count) { return ngettext(singular, plural, count); };\n'

    return content
示例#6
0
def update_jsi18n_file(code="en"):
    """
    For efficieny's sake, we want to cache Django's
    js18n file.  So, generate that file here, then
    save to disk--it won't change until the next language pack update!
    """
    translation.activate(code)  # we switch the language of the whole thread
    output_dir = os.path.join(settings.CONTENT_ROOT, 'locale', 'js', 'i18n')
    ensure_dir(output_dir)
    output_file = os.path.join(output_dir, "%s.js" % code)

    request = HttpRequest()
    request.path = output_file
    request.session = {settings.LANGUAGE_COOKIE_NAME: code}

    response = javascript_catalog(request,
                                  packages=('ka-lite.locale', ),
                                  domain="djangojs")
    icu_js = ""
    for path in settings.LOCALE_PATHS:
        try:
            icu_js = open(os.path.join(path, code, "%s_icu.js" % code),
                          "r").read()
        except IOError:
            logging.warn(
                "No {code}_icu.js file found in locale_path {path}".format(
                    code=code, path=path))
    output_js = response.content + "\n" + icu_js
    logging.info("Writing i18nized js file to {0}".format(output_file))
    with open(output_file, "w") as fp:
        fp.write(output_js)
    translation.deactivate()
示例#7
0
    def i18n_javascript(self, request):
        if settings.USE_I18N:
            from django.views.i18n import javascript_catalog
        else:
            from django.views.i18n import null_javascript_catalog as javascript_catalog

        return javascript_catalog(request, packages=['django_mptt_admin'])
示例#8
0
    def i18n_javascript(self, request):
        """Displays the i18n JavaScript that the Django admin
        requires.

        This takes into account the ``USE_I18N`` setting. If it's set to False, the
        generated JavaScript will be leaner and faster.
        """
        return javascript_catalog(request, packages='pages')
示例#9
0
    def i18n_javascript(self, request):
        """Displays the i18n JavaScript that the Django admin
        requires.

        This takes into account the ``USE_I18N`` setting. If it's set to False, the
        generated JavaScript will be leaner and faster.
        """
        return javascript_catalog(request, packages='pages')
示例#10
0
def jsi18n(request):
    """
        Returns the localisation code and strings for javascript
    """
    js_info_web = {
        'packages': ('sendinel')
    }
    return javascript_catalog(request, packages = js_info_web)
示例#11
0
def javascript_catalog(request):
    return i18n.javascript_catalog(
        request,
        'djangojs',
        {
            'packages': settings.MISAGO_JS_CATALOG_PACKAGES,
        },
    )
示例#12
0
def i18n_javascript(request):
    """
    Displays the i18n JavaScript that the Django admin requires.
    """
    if settings.USE_I18N:  # pragma: no cover
        from django.views.i18n import javascript_catalog
    else:  # pragma: no cover
        from django.views.i18n import null_javascript_catalog as javascript_catalog
    return javascript_catalog(request, packages=['djangobmf'])
示例#13
0
 def handle(self, *args, **options):
     fake_request = HttpRequest()
     for lang in settings.AMO_LANGUAGES:
         filename = os.path.join(settings.STATICFILES_DIRS[0], 'js', 'i18n',
                                 '%s.js' % lang)
         with translation.override(lang):
             response = javascript_catalog(fake_request)
             with open(filename, 'w') as f:
                 f.write(response.content)
示例#14
0
def cached_javascript_catalog(request):
    packages = [
        'wirecloud.commons', 'wirecloud.catalogue', 'wirecloud.platform'
    ]

    for plugin in get_plugins():
        packages.append(plugin.__module__)

    return javascript_catalog(request, "djangojs", packages)
示例#15
0
def i18n_javascript(request):
    """
    Displays the i18n JavaScript that the Django admin requires.
    """
    if settings.USE_I18N:  # pragma: no cover
        from django.views.i18n import javascript_catalog
    else:  # pragma: no cover
        from django.views.i18n import null_javascript_catalog as javascript_catalog
    return javascript_catalog(request, packages=['djangobmf'])
示例#16
0
def cached_javascript_catalog(request, domain="djangojs", packages=None):
    """View for cached JavaScript i18n.  See
    https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#note-on-performance.
    In contrast to the Django docs, however, we set a max-age header so that
    the browser does not try to re-fetch the JavaScript translation catalog for
    one hour.  This way, one can reduce the latency drastically with slow
    server configurations.  The downside, namely that new translations are
    delivered after at most one hour, is absolutely bearable.
    """
    return javascript_catalog(request, domain, packages)
示例#17
0
文件: views.py 项目: colima/juliabase
def cached_javascript_catalog(request, domain="djangojs", packages=None):
    """View for cached JavaScript i18n.  See
    https://docs.djangoproject.com/en/1.7/topics/i18n/translation/#note-on-performance.
    In contrast to the Django docs, however, we set a max-age header so that
    the browser does not try to re-fetch the JavaScript translation catalog for
    one hour.  This way, one can reduce the latency drastically with slow
    server configurations.  The downside, namely that new translations are
    delivered after at most one hour, is absolutely bearable.
    """
    return javascript_catalog(request, domain, packages)
示例#18
0
 def i18n_javascript(self, request):
     """
     Override the original js catalog function to include additional
     js translation messages based on a yawd-admin setting.
     """
     if settings.USE_I18N:
         from django.views.i18n import javascript_catalog
     else:
         from django.views.i18n import null_javascript_catalog as javascript_catalog
     return javascript_catalog(request, packages=['django.conf', 'django.contrib.admin']
                               + getattr(settings, 'ADMIN_JS_CATALOG', []))
示例#19
0
def jsCatalog(request, lang, domain='djangojs', packages=None):
    '''
    Returns the js translation catalog
    :param request:
    :param lang:
    :param domain:
    :param packages:
    '''
    if lang != '':
        request.GET = {'language': lang}  # Fake args for catalog :-)
    return javascript_catalog(request, domain, packages)
示例#20
0
def jsCatalog(request, lang, domain='djangojs', packages=None):
    '''
    Returns the js translation catalog
    :param request:
    :param lang:
    :param domain:
    :param packages:
    '''
    if lang != '':
        request.GET = {'language': lang}  # Fake args for catalog :-)
    return javascript_catalog(request, domain, packages)
示例#21
0
    def i18n_javascript(self, request):
        """
        Библиотека переводов текста
        """
        if settings.USE_I18N:
            from django.views.i18n import javascript_catalog
        else:
            from django.views.i18n import null_javascript_catalog as javascript_catalog

        return javascript_catalog(request,
                                  domain='django',
                                  packages=['django_mptt_admin', 'edw'])
示例#22
0
    def i18n_javascript(self, request):
        """
        Displays the i18n JavaScript that the Django admin requires.

        This takes into account the USE_I18N setting. If it's set to False, the
        generated JavaScript will be leaner and faster.
        """
        if settings.USE_I18N:
            from django.views.i18n import javascript_catalog
        else:
            from django.views.i18n import null_javascript_catalog as javascript_catalog
        return javascript_catalog(request, packages=['django.conf', 'xadmin'])
示例#23
0
def i18n_javascript(request):
    # taken from django.contrib.admin.sites.AdminSite.i18n_javascript
    if settings.USE_I18N:
        from django.views.i18n import javascript_catalog
    else:
        from django.views.i18n import null_javascript_catalog as javascript_catalog
    response = javascript_catalog(request, packages=["django.conf", "django.contrib.admin"])
    response["Content-Type"] = "application/javascript"
    ##expires = datetime.datetime.now() + datetime.timedelta(minutes=5)
    ts = time.time() + 60 * 60 * 24  # 24 hours
    response["Expires"] = http_date(ts)
    return response
示例#24
0
    def i18n_javascript(self, request):
        """
        Displays the i18n JavaScript that the Django admin requires.

        This takes into account the USE_I18N setting. If it's set to False, the
        generated JavaScript will be leaner and faster.
        """
        if settings.USE_I18N:
            from django.views.i18n import javascript_catalog
        else:
            from django.views.i18n import null_javascript_catalog as javascript_catalog
        return javascript_catalog(request, packages=["django.conf", "django.contrib.admin"])
示例#25
0
def javascript_catalog_cached(request):
    global JS_CATALOG_CACHE
    lang = request.session['default_language']
    if lang in JS_CATALOG_CACHE:
        logging.debug('Using js translation catalog cache for %s' % lang)
        src = JS_CATALOG_CACHE[lang]
        return HttpResponse(src, 'text/javascript')
    else:
        logging.debug('Generating js translation catalog for %s' % lang)
        resp = javascript_catalog(request, 'djangojs', settings.INSTALLED_APPS)
        src = resp.content
        JS_CATALOG_CACHE[lang] = src
        return resp
 def i18n_javascript(self, request):
     """
     Override the original js catalog function to include additional
     js translation messages based on a phantom setting.
     """
     if settings.USE_I18N:
         from django.views.i18n import javascript_catalog
     else:
         from django.views.i18n import null_javascript_catalog as javascript_catalog
     return javascript_catalog(
         request,
         packages=['django.conf', 'django.contrib.admin', 'phantom'] +
         getattr(settings, 'ADMIN_JS_CATALOG', []))
示例#27
0
    def get(self, request, *args, **kwargs):
        context = self.get_context()
        """
        Displays the i18n JavaScript that the Django admin requires.

        This takes into account the USE_I18N setting. If it's set to False, the
        generated JavaScript will be leaner and faster.
        """
        if settings.USE_I18N:
            from django.views.i18n import javascript_catalog
        else:
            from django.views.i18n import null_javascript_catalog as javascript_catalog
        return javascript_catalog(request, packages=['django.conf', 'xadmin'])
示例#28
0
def javascript_catalog_cached(request):
    global JS_CATALOG_CACHE
    lang = request.session['default_language']
    if lang in JS_CATALOG_CACHE:
        logging.debug('Using js translation catalog cache for %s' % lang)
        src = JS_CATALOG_CACHE[lang]
        return HttpResponse(src, 'text/javascript')
    else:
        logging.debug('Generating js translation catalog for %s' % lang)
        resp = javascript_catalog(request, 'djangojs', settings.INSTALLED_APPS)
        src = resp.content
        JS_CATALOG_CACHE[lang] = src
        return resp
示例#29
0
def cached_javascript_catalog(request, domain='djangojs', packages=None):
    """A cached version of javascript_catalog."""
    global locale_serials

    package_str = '_'.join(packages)
    try:
        serial = locale_serials[package_str]
    except KeyError:
        serial = generate_locale_serial(packages)
        locale_serials[package_str] = serial

    return cache_memoize(
        'jsi18n-%s-%s-%s-%d' % (domain, package_str, get_language(), serial),
        lambda: javascript_catalog(request, domain, packages),
        large_data=True,
        compress_large_data=True)
示例#30
0
 def _generate(self, language):
     language_bidi = language.split('-')[0] in settings.LANGUAGES_BIDI
     request = HttpRequest()
     request.GET['language'] = language
     # Add some JavaScript data
     content = 'var LANGUAGE_CODE = "%s";\n' % language
     content += 'var LANGUAGE_BIDI = ' + \
         (language_bidi and 'true' or 'false') + ';\n'
     content += javascript_catalog(request,
                                   packages=settings.INSTALLED_APPS).content
     # The hgettext() function just calls gettext() internally, but
     # it won't get indexed by makemessages.
     content += '\nwindow.hgettext = function(text) { return gettext(text); };\n'
     # Add a similar hngettext() function
     content += 'window.hngettext = function(singular, plural, count) { return ngettext(singular, plural, count); };\n'
     return content
示例#31
0
文件: i18n.py 项目: 9gix/RC-Tech
 def _generate(self, language):
     language_bidi = language.split('-')[0] in settings.LANGUAGES_BIDI
     request = HttpRequest()
     request.GET['language'] = language
     # Add some JavaScript data
     content = 'var LANGUAGE_CODE = "%s";\n' % language
     content += 'var LANGUAGE_BIDI = ' + \
         (language_bidi and 'true' or 'false') + ';\n'
     content += javascript_catalog(request,
         packages=settings.INSTALLED_APPS).content
     # The hgettext() function just calls gettext() internally, but
     # it won't get indexed by makemessages.
     content += '\nwindow.hgettext = function(text) { return gettext(text); };\n'
     # Add a similar hngettext() function
     content += 'window.hngettext = function(singular, plural, count) { return ngettext(singular, plural, count); };\n'
     return content
示例#32
0
def update_jsi18n_file(code="en"):
    """
    For efficieny's sake, we want to cache Django's
    js18n file.  So, generate that file here, then
    save to disk--it won't change until the next language pack update!
    """
    output_dir = os.path.join(settings.STATIC_ROOT, "js", "i18n")
    ensure_dir(output_dir)
    output_file = os.path.join(output_dir, "%s.js" % code)

    request = HttpRequest()
    request.path = output_file
    request.session = {'django_language': code}

    response = javascript_catalog(request, packages=('ka-lite.locale', ))
    with open(output_file, "w") as fp:
        fp.write(response.content)
示例#33
0
def update_jsi18n_file(code="en"):
    """
    For efficieny's sake, we want to cache Django's
    js18n file.  So, generate that file here, then
    save to disk--it won't change until the next language pack update!
    """
    output_dir = os.path.join(settings.STATIC_ROOT, "js", "i18n")
    ensure_dir(output_dir)
    output_file = os.path.join(output_dir, "%s.js" % code)

    request = HttpRequest()
    request.path = output_file
    request.session = {"django_language": code}

    response = javascript_catalog(request, packages=("ka-lite.locale",))
    with open(output_file, "w") as fp:
        fp.write(response.content)
示例#34
0
文件: i18n.py 项目: rinunu/mabichara
 def get_output(self, variation):
     if "language" in variation:
         # This file uses i18n, so generate a separate file per language.
         # The language data is always added before all other files.
         if not os.path.exists(i18n_dir):
             os.makedirs(i18n_dir)
         for LANGUAGE_CODE in LANGUAGES:
             LANGUAGE_BIDI = LANGUAGE_CODE.split("-")[0] in settings.LANGUAGES_BIDI
             filename = combined % {"LANGUAGE_CODE": LANGUAGE_CODE}
             filepath = os.path.join(i18n_dir, filename)
             tocombine.append(filepath)
             language_group = [filepath] + abspathed_group
             COMBINE_MEDIA[filename] = language_group
             request = HttpRequest()
             request.GET["language"] = LANGUAGE_CODE
             # Add some JavaScript data
             content = 'var LANGUAGE_CODE = "%s";\n' % LANGUAGE_CODE
             content += "var LANGUAGE_BIDI = " + (LANGUAGE_BIDI and "true" or "false") + ";\n"
             content += javascript_catalog(request, packages=settings.INSTALLED_APPS).content
             # The hgettext() function just calls gettext() internally, but
             # it won't get indexed by makemessages.
             content += "\nwindow.hgettext = function(text) { return gettext(text); };\n"
             # Add a similar hngettext() function
             content += "window.hngettext = function(singular, plural, count) { return ngettext(singular, plural, count); };\n"
             # Check if content changed, so we don't regenerate the i18n
             # file unnecessarily.
             if os.path.exists(filepath):
                 fp = codecs.open(filepath, "r", "utf-8")
                 old_content = fp.read()
                 fp.close()
                 if old_content == content:
                     continue
                 if not silent:
                     print "Updating i18n file %s..." % filename
             else:
                 if not silent:
                     print "Generating i18n file %s..." % filename
             fp = codecs.open(filepath, "w", "utf-8")
             fp.write(content)
             fp.close()
     elif "language_direction" in variation:
         # Generate CSS files for both text directions
         for LANGUAGE_DIR in ("ltr", "rtl"):
             value = {"LANGUAGE_DIR": LANGUAGE_DIR}
             COMBINE_MEDIA[combined % value] = [item % value for item in abspathed_group]
示例#35
0
def update_jsi18n_file(code="en"):
    """
    For efficieny's sake, we want to cache Django's
    js18n file.  So, generate that file here, then
    save to disk--it won't change until the next language pack update!
    """
    translation.activate(code)  # we switch the language of the whole thread
    output_dir = os.path.join(os.path.dirname(__file__), 'static', 'js', 'i18n')
    ensure_dir(output_dir)
    output_file = os.path.join(output_dir, "%s.js" % code)

    request = HttpRequest()
    request.path = output_file
    request.session = {settings.LANGUAGE_COOKIE_NAME: code}

    response = javascript_catalog(request, packages=('ka-lite.locale',))
    with open(output_file, "w") as fp:
        fp.write(response.content)
示例#36
0
def update_jsi18n_file(code="en"):
    """
    For efficieny's sake, we want to cache Django's
    js18n file.  So, generate that file here, then
    save to disk--it won't change until the next language pack update!
    """
    translation.activate(code)  # we switch the language of the whole thread
    output_dir = os.path.join(os.path.dirname(__file__), 'static', 'js', 'i18n')
    ensure_dir(output_dir)
    output_file = os.path.join(output_dir, "%s.js" % code)

    request = HttpRequest()
    request.path = output_file
    request.session = {settings.LANGUAGE_COOKIE_NAME: code}

    response = javascript_catalog(request, packages=('ka-lite.locale',))
    with open(output_file, "w") as fp:
        fp.write(response.content)
示例#37
0
    def i18n_javascript(self, request):
        """
        Displays the i18n JavaScript that the Django admin requires.

        This takes into account the USE_I18N setting. If it's set to False, the
        generated JavaScript will be leaner and faster.
        """
        if settings.USE_I18N:
            from django.views.i18n import javascript_catalog
        else:
            from django.views.i18n import null_javascript_catalog as javascript_catalog
        # Gives plugins the ability to add your translation scripts.
        packages = getattr(settings, 'XADMIN_I18N_JAVASCRIPT_PACKAGES', [])
        try:
            packages.extend(['django.conf', 'xadmin'])
        except AttributeError:
            raise ImproperlyConfigured('Expected list type as attribute '
                                       'in "XADMIN_I18N_JAVASCRIPT_PACKAGES"')
        return javascript_catalog(request, packages=packages)
示例#38
0
    def i18n_javascript(self, request):
        """
        Override the original js catalog function to include additional
        js translation messages based on a yawd-admin setting and cache
        the results per language.
        """
        cache_key = 'ya-jsi18n-%s' % get_language()
        cache_timeout = getattr(settings, 'ADMIN_JS_CATALOG_CACHE_TIMEOUT', 60 * 60)
        cached = cache.get(cache_key)

        if not cached or not cache_timeout:
            if settings.USE_I18N:
                from django.views.i18n import javascript_catalog
            else:
                from django.views.i18n import null_javascript_catalog as javascript_catalog

            cached = javascript_catalog(request, packages=['django.conf',
                                                     'django.contrib.admin',
                                                     'yawdadmin']
                                  + getattr(settings, 'ADMIN_JS_CATALOG', []))
            cache.set(cache_key, cached, cache_timeout)

        return cached
示例#39
0
    def i18n_javascript(self, request):
        """
        Override the original js catalog function to include additional
        js translation messages based on a yawd-admin setting and cache
        the results per language.
        """
        cache_key = 'ya-jsi18n-%s' % get_language()
        cache_timeout = getattr(settings, 'ADMIN_JS_CATALOG_CACHE_TIMEOUT', 60 * 60)
        cached = cache.get(cache_key)

        if not cached or not cache_timeout:
            if settings.USE_I18N:
                from django.views.i18n import javascript_catalog
            else:
                from django.views.i18n import null_javascript_catalog as javascript_catalog

            cached = javascript_catalog(request, packages=['django.conf',
                                                     'django.contrib.admin',
                                                     'yawdadmin']
                                  + getattr(settings, 'ADMIN_JS_CATALOG', []))
            cache.set(cache_key, cached, cache_timeout)

        return cached
示例#40
0
def jsi18n(request, domain='djangojs', packages=None):
    return javascript_catalog(request, domain, packages)
示例#41
0
def jsi18n(request, packages=None, domain=None):
    if not domain:
        domain = 'djangojs'
    from django.views.i18n import javascript_catalog
    return javascript_catalog(request, domain, packages)
示例#42
0
def jsi18n(request):
    return javascript_catalog(request, 'djangojs', ['userlog'])
示例#43
0
def javascript_catalog_all(request, domain='djangojs'):
    """
    Get JavaScript message catalog for all apps in INSTALLED_APPS.
    """
    all_apps = [x.name for x in apps.get_app_configs()]
    return javascript_catalog(request, domain, all_apps)
示例#44
0
文件: urls.py 项目: anukat2015/datal
def jsi18n(request, packages=None, domain=None):
    if not domain:
        domain = 'djangojs'
    from django.views.i18n import javascript_catalog
    return javascript_catalog(request, domain, packages)
示例#45
0
文件: urls.py 项目: mxabierto/datal
def jsi18n(request, packages=None, domain=None):
    if not domain:
        domain = 'djangojs'
    return javascript_catalog(request, domain, packages)
示例#46
0
from functools import update_wrapper
示例#47
0
def cached_js_catalog(request, domain='djangojs', packages=None):
    return javascript_catalog(request, domain, packages)
示例#48
0
 def read(self, request):
     return javascript_catalog(request, **js_info_dict)
示例#49
0
def jsi18n(request, packages=None, domain=None):
    if not domain:
        domain = 'djangojs'
    return javascript_catalog(request, domain, packages)
示例#50
0
def jsi18n(request):
    return javascript_catalog(request, 'djangojs', ['userlog'])
示例#51
0
文件: views.py 项目: nescode/Misago
def javascript_catalog(request):
    return i18n.javascript_catalog(request, 'djangojs', None)
示例#52
0
 def i18n_javascript(self, request):
     return javascript_catalog(request, packages='lemon.filebrowser')
示例#53
0
文件: views.py 项目: pylixm/Misago
def javascript_catalog(request):
    return i18n.javascript_catalog(request, 'djangojs', None)
def cached_javascript_catalog(request, domain="djangojs", packages=None):
    return javascript_catalog(request, domain, packages)
示例#55
0
def cached_javascript_catalog(request, domain='djangojs', packages=None):
    """
    https://docs.djangoproject.com/en/1.5/topics/i18n/translation/#note-on-performance
    """
    return javascript_catalog(request, domain, packages)
示例#56
0
def cached_javascript_catalog(request, domain='djangojs', packages=None):
    return i18n.javascript_catalog(request, domain, packages)
示例#57
0
def cached_javascript_catalog(request, domain='djangojs', packages=None):
    if packages is None:
        packages = tuple(settings.INSTALLED_APPS) + ('django.conf',)
    return javascript_catalog(request, domain, packages)