Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add contextual markers to base templates

Marco Badanf5a048f21f0e
diff --git a/templates/base.html b/templates/base.html
index beea1729fc..7f71f85288 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -10,7 +10,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="{% block meta_description %}{% endblock %}">
- <meta name="author" content="{% trans "Mirumee Software" %}">
+ <meta name="author" content="{% trans "Mirumee Software" context "Meta author text" %}">
{% endblock meta %}
{% include 'favicon.html' %}
{% render_bundle 'vendor' 'css' %}
@@ -38,21 +38,28 @@
{% if user.is_authenticated %}
{% if user.is_staff %}
<li>
- <a href="{% url "dashboard:index" %}" traget="_blank">{% trans "Dashboard" %}</a>
+ <a href="{% url "dashboard:index" %}" target="_blank" rel="noopener">
+ {% trans "Dashboard" context "Top navbar link text" %}
+ </a>
</li>
{% endif %}
<li>
- <a href="{% url "profile:details" %}">{% trans "Your account" %}</a>
+ <a href="{% url "profile:details" %}">
+ {% trans "Your account" context "Top navbar link text" %}</a>
</li>
<li>
- <a href="{% url "account_logout" %}">{% trans "Log out" %}</a>
+ <a href="{% url "account_logout" %}">
+ {% trans "Log out" context "Top navbar link text" %}</a>
</li>
{% else %}
<li>
- <a href="{% url "account_signup" %}">{% trans "Register" %}</a>
+ <a href="{% url "account_signup" %}">
+ {% trans "Register" context "Top navbar link text" %}</a>
</li>
<li>
- <a href="{% url "account_login" %}">{% trans "Log in" %}</a>
+ <a href="{% url "account_login" %}">
+ {% trans "Log in" context "Top navbar link text" %}
+ </a>
</li>
{% endif %}
</ul>
@@ -66,7 +73,7 @@
<div class="col-8 col-md-4 navbar__logo">
<div class="menu-icon-mobile hidden-md-up">
<img class="navbar__brand__menu-toggle closed open" src="{% static "images/mobile-bar.svg" %}">
- <span>{% trans "menu" %}</span>
+ <span>{% trans "menu" context "Hamburger button text" %}</span>
</div>
<a href="/">
<img src="{% static "images/saleor-logo-black.svg" %}" alt="Testeor - Saleor demo store" height="38">
@@ -91,7 +98,9 @@
<div class="col-2 col-md-4">
<div class="navbar__brand__cart float-right">
<a class="cart__icon" href="{% url "cart:index" %}">
- <span class="cart-label hidden-sm-down">{% trans "Your Cart" %}</span>
+ <span class="cart-label hidden-sm-down">
+ {% trans "Your Cart" context "Top navbar link" %}
+ </span>
<img class="navbar__brand__cart__icon" src="{% static "images/cart.svg" %}" alt="Cart">
<span class="badge {% if not cart_counter %}empty{% endif %}">
{% if cart_counter %}
@@ -165,38 +174,45 @@
<ul>
<li>
<a href="{% url "cart:index" %}">
- {% trans "Cart" %}
+ {% trans "Cart" context "Top navbar link" %}
</a>
</li>
{% if user.is_authenticated %}
{% if user.is_staff %}
<li>
- <a href="{% url "dashboard:index" %}" traget="_blank">{% trans "Dashboard" %}</a>
+ <a href="{% url "dashboard:index" %}" target="_blank" rel="noopener">
+ {% trans "Dashboard" context "Top navbar link" %}
+ </a>
</li>
{% endif %}
<li>
<a href="{% url "profile:details" %}">
- {% trans "Your account" %}
+ {% trans "Your account" context "Top navbar link" %}
</a>
</li>
<li>
- <a href="{% url "account_logout" %}">{% trans "Log out" %}</a>
+ <a href="{% url "account_logout" %}">
+ {% trans "Log out" context "Top navbar link" %}</a>
</li>
{% else %}
<li>
- <a href="{% url "account_signup" %}">{% trans "Register" %}</a>
+ <a href="{% url "account_signup" %}">
+ {% trans "Register" context "Top navbar link" %}
+ </a>
</li>
<li>
- <a href="{% url "account_login" %}">{% trans "Log in" %}</a>
+ <a href="{% url "account_login" %}">
+ {% trans "Log in" context "Top navbar link" %}
+ </a>
</li>
{% endif %}
</ul>
</div>
<div class="col-md-3 col-sm-12">
- <a target="_blank" class="github-footer" href="https://github.com/mirumee/saleor">
+ <a target="_blank" rel="noopener" class="github-footer" href="https://github.com/mirumee/saleor">
<img src="{% static "images/github_logo.svg" %}">
</a>
- <a target="_blank" href="https://twitter.com/getsaleor">
+ <a target="_blank" rel="noopener" href="https://twitter.com/getsaleor">
<img src="{% static "images/twitter_logo.svg" %}">
</a>
</div>
diff --git a/templates/cart-dropdown.html b/templates/cart-dropdown.html
index 13571a57a3..eea6ff68c1 100644
--- a/templates/cart-dropdown.html
+++ b/templates/cart-dropdown.html
@@ -28,7 +28,9 @@
</div>
<div class="row cart-dropdown__total" data-quantity="{{ quantity }}">
<div class="col-md-8">
- <h3>{% trans "Subtotal" %} <br> <span>{% trans "(Delivery calculated at checkout)" %}</span></h3>
+ <h3>{% trans "Subtotal" context "Cart dropdown text" %}
+ <br>
+ <span>{% trans "(Delivery calculated at checkout)" context "Cart dropdown text" %}</span></h3>
</div>
<div class="col-md-4">
<h3 class="float-md-right price {% if lines|length <= 2 %}single{% endif %}" data-quantity="{{ quantity }}">
@@ -38,17 +40,17 @@
</div>
<div class="row cart-dropdown__actions">
<div class="col-md-5 offset-md-1">
- <a href="{% url "cart:index" %}" class="btn secondary float-md-right">{% trans "Go to cart" %}</a>
+ <a href="{% url "cart:index" %}" class="btn secondary float-md-right">{% trans "Go to cart" context "Cart dropdown secondary action" %}</a>
</div>
<div class="col-md-5">
- <a href="{% url "checkout:login" %}" class="btn primary">{% trans "Checkout" %}</a>
+ <a href="{% url "checkout:login" %}" class="btn primary">{% trans "Checkout" context "Cart dropdown primary action" %}</a>
</div>
</div>
{% else %}
<div class="text-md-center cart-dropdown__empty">
<h3>{% trans "There are no products in your shopping cart." %}</h3>
<img src="{% static 'images/pirate_cart.png' %}" srcset="{% static 'images/pirate_cart.png' %} 1x, {% static 'images/pirate_cart2x.png' %} 2x">
- <a href="/" class="btn primary">{% trans "Check out our sales" %}</a>
+ <a href="/" class="btn primary">{% trans "Check out our sales" context "Empty cart dropdown text" %}</a>
</div>
{% endif %}
</div>
diff --git a/templates/home.html b/templates/home.html
index b87067e9d1..306a16e39c 100644
--- a/templates/home.html
+++ b/templates/home.html
@@ -10,9 +10,11 @@
<div class="home--content">
<div class="home--content-wrapper">
<div class="home--content-inner">
- <h1>{% trans "Promo &amp; Sale" %}</h1>
- <h2>{% trans "form the Northpole" %}</h2>
- <a class="btn btn-secondary home__button" href="#">{% trans "Shop now" %}</a>
+ <h1>{% trans "Promo &amp; Sale" context "Homepage title" %}</h1>
+ <h2>{% trans "form the Northpole" context "Homepage title" %}</h2>
+ <a class="btn btn-secondary home__button" href="#">
+ {% trans "Shop now" context "Homepage action" %}
+ </a>
</div>
</div>
</div>
@@ -25,8 +27,8 @@
<div class="home--content">
<div class="home--content-wrapper">
<div class="home--content-inner">
- <h1>{% trans "Size &amp; Colours" %}</h1>
- <a class="btn btn-secondary home__button" href="#">{% trans "Shop now" %}</a>
+ <h1>{% trans "Size &amp; Colours" context "Homepage title" %}</h1>
+ <a class="btn btn-secondary home__button" href="#">{% trans "Shop now" context "Homepage action" %}</a>
</div>
</div>
</div>
@@ -37,8 +39,8 @@
<div class="home--content">
<div class="home--content-wrapper">
<div class="home--content-inner">
- <h1>{% trans "Digital Downloads" %}</h1>
- <a class="btn btn-secondary home__button" href="#">{% trans "Shop now" %}</a>
+ <h1>{% trans "Digital Downloads" context "Homepage title" %}</h1>
+ <a class="btn btn-secondary home__button" href="#">{% trans "Shop now" context "Homepage action" %}</a>
</div>
</div>
</div>
@@ -46,7 +48,7 @@
</div>
</div>
<div class="home__featured">
- <h2 class="text-center">{% trans "Featured products" %}</h2>
+ <h2 class="text-center">{% trans "Featured products" context "Homepage title" %}</h2>
<div class="row">
{% include "category/_items.html" %}
</div>