忽略Django Template CSS字体文件中的国际化

时间:2016-03-18 07:01:01

标签: python django django-templates

我在我的Django模板文件中定义了

@font-face {
    font-family: "EmojiSymbols";
    src: url('EmojiSymbols-Regular.woff') format('woff');
    text-decoration: none;
    font-style: normal;
    font-size: 200%;
}

当我实施内部化时,所有事情都在发现,除了我一直在寻找(选择其中一种语言的例子)

Not Found: /en/EmojiSymbols-Regular.woff
[17/Mar/2016 12:16:31] "GET /en/EmojiSymbols-Regular.woff HTTP/1.1" 301 0
Not Found: /en/EmojiSymbols-Regular.woff/
[17/Mar/2016 12:16:31] "GET /en/EmojiSymbols-Regular.woff/ HTTP/1.1" 404 1730

如何让Django忽略国际化CSS字体来源?或者我必须在Manually Switch languages中手动告诉它?虽然CSS代码块中没有翻译(aka {%trans ...)。请帮忙。

以下是模板:

<!doctype html>
<html lang="{{ LANGUAGE_CODE }}"{% if LANGUAGE_BIDI %} dir="rtl"{% endif %}>
{% load pages_tags mezzanine_tags i18n future staticfiles %}

<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="keywords" content="{% block meta_keywords %}{% endblock %}">
<meta name="description" content="{% block meta_description %}{% endblock %}">
<title>{% block meta_title %}{% endblock %}{% if settings.SITE_TITLE %} | {{ settings.SITE_TITLE }}{% endif %}</title>
<link rel="shortcut icon" href="{% static "img/favicon.ico" %}">

{% compress css %}
<link rel="stylesheet" href="{% static "css/bootstrap.css" %}">
{% if LANGUAGE_BIDI %}
    <link rel="stylesheet" href="{% static "css/bootstrap-rtl.css" %}">
{% endif %}
{% endcompress %}

{% compress js %}
<script src="{% static "js/bootstrap.js" %}"></script>
<script src="{% static "js/bootstrap-extras.js" %}">   
  </script>
{% endcompress %}

{% block local_style %}
<style>
@font-face {
    font-family: "EmojiSymbols";
    src: url('EmojiSymbols-Regular.woff') format('woff');
    text-decoration: none;
    font-style: normal;
    font-size: 200%;
}
.emj {
    font-family: "EmojiSymbols";
    line-height:1;
}
</style>
{% endblock local_style %}

{% block extra_head %}{% endblock %}
</head>

请注意。所有网页都支持所有受支持的语言,没有任何问题。对于字体文件,仅在控制台上显示Not Found错误。

0 个答案:

没有答案