Merge pull request #338 from HenryGBC/develop

Create Templatetag
This commit is contained in:
Levi Velázquez 2017-06-13 23:40:56 -05:00 committed by GitHub
commit f6f3d0dd6a
6 changed files with 185 additions and 21 deletions

View file

@ -76,6 +76,54 @@ msgid "Thank you!"
msgstr "Vielen Dank!" msgstr "Vielen Dank!"
#: templates/datacenterlight/home.html:15 #: templates/datacenterlight/home.html:15
#: templates/datacenterlight/index.html:62
#: templates/datacenterlight/index.html:160
#: templates/datacenterlight/index.html:383
#: templates/datacenterlight/order.html:24
#: templates/datacenterlight/order.html:165
#: templates/datacenterlight/pricing.html:62
#: templates/datacenterlight/pricing.html:190
#: templates/datacenterlight/success.html:23
msgid "What is it"
msgstr "Was ist es?"
#: templates/datacenterlight/index.html:65
#: templates/datacenterlight/index.html:189
#: templates/datacenterlight/index.html:386
#: templates/datacenterlight/order.html:27
#: templates/datacenterlight/order.html:168
#: templates/datacenterlight/pricing.html:65
#: templates/datacenterlight/pricing.html:193
#: templates/datacenterlight/success.html:26
msgid "Scale out"
msgstr "Skalierung"
#: templates/datacenterlight/index.html:68
#: templates/datacenterlight/index.html:215
#: templates/datacenterlight/index.html:389
#: templates/datacenterlight/order.html:30
#: templates/datacenterlight/order.html:171
#: templates/datacenterlight/pricing.html:68
#: templates/datacenterlight/pricing.html:196
#: templates/datacenterlight/success.html:29
msgid "Reliable and light"
msgstr "Zuverlässig und leicht"
#: templates/datacenterlight/index.html:71
msgid "Order VM"
msgstr "VM bestellen"
#: templates/datacenterlight/index.html:74
#: templates/datacenterlight/index.html:396
#: templates/datacenterlight/order.html:36
#: templates/datacenterlight/order.html:178
#: templates/datacenterlight/pricing.html:74
#: templates/datacenterlight/pricing.html:203
#: templates/datacenterlight/success.html:35
msgid "Contact"
msgstr "Kontakt"
#: templates/datacenterlight/index.html:127
msgid "Finally, an affordable VM hosting in Switzerland!" msgid "Finally, an affordable VM hosting in Switzerland!"
msgstr "Endlich: bezahlbares VM Hosting in der Schweiz" msgstr "Endlich: bezahlbares VM Hosting in der Schweiz"
@ -169,6 +217,14 @@ msgstr ""
msgid "We are cutting down the costs significantly!" msgid "We are cutting down the costs significantly!"
msgstr "Wir sorgen dafür, dass die Kosten für Sie signifikant abnehmen" msgstr "Wir sorgen dafür, dass die Kosten für Sie signifikant abnehmen"
#: templates/datacenterlight/index.html:236
#: templates/datacenterlight/order.html:143
#: templates/datacenterlight/pricing.html:168
msgid "Simple and affordable: Try our virtual machine with featherlight price."
msgstr ""
"Einfach und bezahlbar: Teste nun unsere virtuellen Maschinen mit "
"federleichten Preisen."
#: templates/datacenterlight/home.html:137 #: templates/datacenterlight/home.html:137
msgid "Affordable VM hosting based in Switzerland" msgid "Affordable VM hosting based in Switzerland"
msgstr "Bezahlbares VM Hosting in der Schweiz" msgstr "Bezahlbares VM Hosting in der Schweiz"
@ -259,6 +315,86 @@ msgstr ""
#: templates/datacenterlight/order.html:87 #: templates/datacenterlight/order.html:87
#: templates/datacenterlight/pricing.html:86 #: templates/datacenterlight/pricing.html:86
#: templates/datacenterlight/index.html:248
#: templates/datacenterlight/order.html:81
#: templates/datacenterlight/pricing.html:119
msgid "VM hosting"
msgstr "VM Hosting"
#: templates/datacenterlight/index.html:252
msgid "month"
msgstr "Monat"
#: templates/datacenterlight/index.html:256
#: templates/datacenterlight/order.html:89
#: templates/datacenterlight/pricing.html:127
msgid "Hosted in Switzerland"
msgstr "Standort des Datacenters ist in der Schweiz"
#: templates/datacenterlight/index.html:273
#: templates/datacenterlight/order.html:106
#: templates/datacenterlight/pricing.html:144
msgid "GB Storage (SSD)"
msgstr "GB Storage (SSD)"
#: templates/datacenterlight/index.html:297
#: templates/datacenterlight/order.html:133
#: templates/datacenterlight/pricing.html:161
msgid "Order Now!"
msgstr "Bestelle jetzt!"
#: templates/datacenterlight/index.html:302
msgid "Want to know more? Subscribe to our newsletter!"
msgstr "Willst du mehr wissen? Abonniere unseren Newsletter!"
#: templates/datacenterlight/index.html:364
#: templates/datacenterlight/index.html:279
#: templates/datacenterlight/index.html:317
msgid "I want to have it!"
msgstr "Das möchte ich haben!"
#: templates/datacenterlight/index.html:344
msgid "Switzerland "
msgstr "Schweiz"
#: templates/datacenterlight/index.html:361
msgid "Questions?"
msgstr "Fragen?"
#: templates/datacenterlight/index.html:361
msgid "Contact us!"
msgstr "Kontaktiere uns!"
#: templates/datacenterlight/index.html:379
#: templates/datacenterlight/order.html:161
#: templates/datacenterlight/pricing.html:186
msgid "Home"
msgstr "Home"
#: templates/datacenterlight/index.html:377
#: templates/datacenterlight/index.html:354
#: templates/datacenterlight/new-order.html:212
#: templates/datacenterlight/order.html:212
#: templates/datacenterlight/index.html:392
#: templates/datacenterlight/order.html:174
#: templates/datacenterlight/pricing.html:199
msgid "Pricing"
msgstr "Preise"
#: templates/datacenterlight/order.html:33
#: templates/datacenterlight/pricing.html:71
#: templates/datacenterlight/success.html:32
msgid "Buy VM"
msgstr "VM Kaufen"
#: templates/datacenterlight/order.html:68
#: templates/datacenterlight/pricing.html:106
msgid "We are cutting down the costs significantly!"
msgstr "Wir sorgen dafür, dass die Kosten für Sie signifikant abnehmen"
#: templates/datacenterlight/order.html:146
#: templates/datacenterlight/pricing.html:171
msgid "" msgid ""
"Our VMs are hosted in Glarus, Switzerland, and our website is currently " "Our VMs are hosted in Glarus, Switzerland, and our website is currently "
"running in BETA mode. If you want more information that you did not find on " "running in BETA mode. If you want more information that you did not find on "
@ -275,6 +411,7 @@ msgstr ""
"Anliegen kümmern!" "Anliegen kümmern!"
#: templates/datacenterlight/success.html:8 #: templates/datacenterlight/success.html:8
#: templates/datacenterlight/success.html:62
msgid "Thank you for order! Our team will contact you via email" msgid "Thank you for order! Our team will contact you via email"
msgstr "" msgstr ""
"Vielen Dank für die Bestellung. Unser Team setzt sich sobald wie möglich mit " "Vielen Dank für die Bestellung. Unser Team setzt sich sobald wie möglich mit "
@ -316,6 +453,24 @@ msgstr ""
#~ msgid "More Info" #~ msgid "More Info"
#~ msgstr "Weitere Informationen" #~ msgstr "Weitere Informationen"
#~ msgid "Want to know more? Subscribe to our newsletter!"
#~ msgstr "Willst du mehr wissen? Abonniere unseren Newsletter!"
#~ msgid "I want to have it!"
#~ msgstr "Das möchte ich haben!"
#~ msgid "Buy VM"
#~ msgstr "VM Kaufen"
#: templates/datacenterlight/success.html:64
msgid "as soon as possible!"
msgstr ""
#~ msgid "Based in Switzerland"
#~ msgstr "Standort des Datacenters ist in der Schweiz"
#~ msgid "10 GB Storage (SSD)"
#~ msgstr "10 GB Storage (SSD)"
#~ msgid "Request Newsletter" #~ msgid "Request Newsletter"
#~ msgstr "Newsletter abonnieren" #~ msgstr "Newsletter abonnieren"

View file

@ -1,5 +1,6 @@
{% load staticfiles i18n%} {% load staticfiles i18n%}
{% get_current_language as LANGUAGE_CODE %} {% get_current_language as LANGUAGE_CODE %}
{% load custom_tags %}
<nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation"> <nav class="navbar navbar-default navbar-fixed-top topnav" role="navigation">
<div class="topnav"> <div class="topnav">
<!-- Brand and toggle get grouped for better mobile display --> <!-- Brand and toggle get grouped for better mobile display -->
@ -49,29 +50,12 @@
</div> </div>
<div class="drop-language"> <div class="drop-language">
{% if LANGUAGE_CODE == 'en-us'%} {% if LANGUAGE_CODE == 'en-us'%}
{% if request.resolver_match.url_name == "index" %} <a class="url" href="{% change_lang 'de' %}">Deutsch</a>
<a class="url" href="{{base_url}}/de/datacenterlight" >Deutsch</a>
{% endif %}
{% if request.resolver_match.url_name == "order" %}
<a class="url" href="{{base_url}}/de/datacenterlight/order" >Deutsch</a>
{% endif %}
{% if request.resolver_match.url_name == "pricing" %}
<a class="url" href="{{base_url}}/de/datacenterlight/pricing" >Deutsch</a>
{% endif %}
{% else %} {% else %}
{% if request.resolver_match.url_name == "index" %} <a class="url" href="{% change_lang 'en-us' %}" >English</a>
<a class="url" href="{{base_url}}/en-us/datacenterlight" >English</a>
{% endif %}
{% if request.resolver_match.url_name == "order" %}
<a class="url" href="{{base_url}}/en-us/datacenterlight/order" >Deutsch</a>
{% endif %}
{% if request.resolver_match.url_name == "pricing" %}
<a class="url" href="{{base_url}}/en-us/datacenterlight/pricing" >Deutsch</a>
{% endif %}
<a class="url" href="{{base_url}}/en-us/datacenterlight" ></a>
{% endif %} {% endif %}
</div> </div>
</li> </li>
</ul> </ul>

View file

@ -20,7 +20,7 @@
<a class="btn btn-default btn-lg btn-transparent url" href="javascript:void(0)" data-url="#how" ><i class="#Services"></i> <span class="network-name">{% trans "What is it?" %}</span></a> <a class="btn btn-default btn-lg btn-transparent url" href="javascript:void(0)" data-url="#how" ><i class="#Services"></i> <span class="network-name">{% trans "What is it?" %}</span></a>
</li> </li>
<li> <li>
<a class="btn btn-primary btn-lg page-scroll url" href="javascript:void(0)" data-url="#request" ><span class="network-name">{% trans "I want it!" %}</span></a> <a class="btn btn-primary btn-lg page-scroll url" href="javascript:void(0)" data-url="#price" ><span class="network-name">{% trans "I want it!" %}</span></a>
</li> </li>
</ul> </ul>
</div> </div>

View file

View file

@ -0,0 +1,24 @@
from django import template
from django.core.urlresolvers import resolve, reverse
from django.utils.translation import activate, get_language
register = template.Library()
@register.simple_tag(takes_context=True)
def change_lang(context, lang=None, *args, **kwargs):
path = context['request'].path
url_parts = resolve( path )
url = path
cur_language = get_language()
try:
activate(lang)
url = reverse( url_parts.view_name, kwargs=url_parts.kwargs )
finally:
activate(cur_language)
return "%s" % url

View file

@ -110,6 +110,7 @@ INSTALLED_APPS = (
'digitalglarus', 'digitalglarus',
'nosystemd', 'nosystemd',
'datacenterlight', 'datacenterlight',
'datacenterlight.templatetags',
'alplora', 'alplora',
'rest_framework', 'rest_framework',
'opennebula_api' 'opennebula_api'