Skip to content

Commit

Permalink
[Bug 1241629] Use correct domain for jsi18n urls.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Kelly committed Feb 23, 2016
1 parent 20a6cf3 commit e0743ee
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 7 deletions.
4 changes: 4 additions & 0 deletions kitsune/sumo/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import urlparse

from django.conf import settings
from django.contrib.staticfiles.templatetags.staticfiles import static
from django.core.urlresolvers import reverse as django_reverse
from django.http import QueryDict
from django.utils.encoding import smart_str
Expand Down Expand Up @@ -443,3 +444,6 @@ def add_utm(url_, campaign, source='notification', medium='email'):
@register.function
def to_unicode(str):
return unicode(str)


register.function(static)
6 changes: 4 additions & 2 deletions kitsune/sumo/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,13 @@

{{ csrf() }}

{# TODO: The BUILD_ID_JS changes whenever our js code changes.
{# TODO: The JS url changes whenever our js code changes.
But this should get cached busted whenever a locale is updated.
It's complicatred to fix. But for now it isn't more broken than
before. #}
<script src="{{ STATIC_URL }}jsi18n/{{ request.LANGUAGE_CODE|lower }}/javascript.js?{{ BUILD_ID_JS }}"></script>
{% if request.LANGUAGE_CODE %}
<script src="{{ static('jsi18n/{lang}/djangojs.js'|f(lang=request.LANGUAGE_CODE|lower)) }}"></script>
{% endif %}

{# Optimizely script for A/B testing - Bug 850816 #}
{% if waffle.flag('optimizely') %}
Expand Down
6 changes: 4 additions & 2 deletions kitsune/sumo/templates/mobile/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,13 @@ <h1>

{% block after_main %}{% endblock %}

{# TODO: The BUILD_ID_JS changes whenever our js code changes.
{# TODO: The JS url changes whenever our js code changes.
But this should get cached busted whenever a locale is updated.
It's complicatred to fix. But for now it isn't more broken than
before. #}
<script src="{{ STATIC_URL }}jsi18n/{{ request.LANGUAGE_CODE|lower }}/javascript.js?{{ BUILD_ID_JS }}"></script>
{% if request.LANGUAGE_CODE %}
<script src="{{ static('jsi18n/{lang}/djangojs.js'|f(lang=request.LANGUAGE_CODE|lower)) }}"></script>
{% endif %}

{% javascript 'mobile-common' %}
{% for script in scripts %}
Expand Down
6 changes: 4 additions & 2 deletions kitsune/sumo/templates/mobile/minimal.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,13 @@

{% block after_main %}{% endblock %}

{# TODO: The BUILD_ID_JS changes whenever our js code changes.
{# TODO: The JS url changes whenever our js code changes.
But this should get cached busted whenever a locale is updated.
It's complicatred to fix. But for now it isn't more broken than
before. #}
<script src="{{ STATIC_URL }}jsi18n/{{ request.LANGUAGE_CODE|lower }}/javascript.js?{{ BUILD_ID_JS }}"></script>
{% if request.LANGUAGE_CODE %}
<script src="{{ static('jsi18n/{lang}/djangojs.js'|f(lang=request.LANGUAGE_CODE|lower)) }}"></script>
{% endif %}

{% for script in scripts %}
{% javascript script %}
Expand Down
2 changes: 1 addition & 1 deletion kitsune/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

# Javascript translations.
url(r'^jsi18n/.*$', cache_page(60 * 60 * 24 * 365)(javascript_catalog),
{'domain': 'javascript', 'packages': ['kitsune']}, name='jsi18n'),
{'domain': 'djangojs', 'packages': ['kitsune']}, name='jsi18n'),
# App translations. These don't need cached because they are downloaded
# in a build step, not on the client.
url(r'^jsi18n-yaocho/.*$', javascript_catalog,
Expand Down
1 change: 1 addition & 0 deletions scripts/travis/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,5 @@ echo "Running migrations"

echo "Doing static dance."
./manage.py nunjucks_precompile
./manage.py compilejsi18n
./manage.py collectstatic --noinput > /dev/null

0 comments on commit e0743ee

Please sign in to comment.