Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update countries.html (translation) #16

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 41 additions & 37 deletions myproject/myapp/templates/countries.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
<!DOCTYPE html>
{% load custom_filters %}
{% load django_bootstrap5 %}
{% load i18n %}
{% load static %}
<html lang="en">
<html lang="{{ LANGUAGE_CODE }}">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>REST Countries Info APP</title>
<title>{% trans "REST Countries Info APP" %}</title>
{% bootstrap_css %}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" integrity="sha256-mUZM63G8m73Mcidfrv5E+Y61y7a12O5mW4ezU3bxqW4=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"
integrity="sha256-mUZM63G8m73Mcidfrv5E+Y61y7a12O5mW4ezU3bxqW4=" crossorigin="anonymous">
<link rel="stylesheet" href="{% static 'css/countries.css'%}">
<script src="{% static 'js/countries.js' %}"></script>
<link rel="icon" href="{% static 'img/favicon.ico' %}">
Expand All @@ -18,10 +20,10 @@
<body>
<header>
<div>
<h1>Countries of the World</h1>
<h1>{% trans "Countries of the World" %}</h1>
<form method="get" action="{% url 'search_countries' %}" class="form-inline" id="search-form">
{{ search_form.search_term }}
<button type="submit" id="search-glass" aria-label="Search">
<button type="submit" id="search-glass" aria-label="{% trans 'Search' %}">
<i class="fa fa-search"></i>
</button>
<ul>
Expand All @@ -36,102 +38,103 @@ <h1>Countries of the World</h1>
</form>
{% else %}
<button type="button" id="back-button" class="btn btn-primary"
onclick="window.location.href='/countries'">Back</button>
onclick="window.location.href='/countries'">{% trans 'Back' %}</button>
{% endif %}
</div>
</header>
<main>
<div id="country-container" class="container">
{% for country in country_data %}
<div id="country-card">
<img src="{{ country.flags.png }}" alt="{{ country.name.common }} flag" id="img">
<img src="{{ country.flags.png }}" alt="{{ country.name.common }} {% trans 'flag' %}" id="img">
<h1 id="country-name">{{ country.name.common }}</h1>
<p>Capital:
<p>{% trans 'Capital' %}:
{% if country.capital %}
{{ country.capital.0 }}
{% else %}
N/A
{% trans 'N/A' %}
{% endif %}
</p>
<p>Population:
<p>{% trans 'Population' %}:
{% if country.population %}
{{ country.population }}
{% else %}
N/A
{% trans 'N/A' %}
{% endif %}
</p>
<p>Region:
<p>{% trans 'Region' %}:
{% if country.region %}
{{ country.region }}
{% else %}
N/A
{% trans 'N/A' %}
{% endif %}
</p>
<p>Subregion:
<p>{% trans 'Subregion' %}:
{% if country.subregion %}
{{ country.subregion }}
{% else %}
N/A
{% trans 'N/A' %}
{% endif %}
</p>
{% if not search_form.search_term.value %}
{% with country.name.common|get_emblems_url as emblems %}
{% if emblems %}
<img src="{{ emblems }}" alt="{{ country.name.common }} emblem" class="img2">
<img src="{{ emblems }}" alt="{{ country.name.common }} {% trans 'emblem' %}" class="img2">
{% else %}
<img src="{{ country.coatOfArms.svg }}" alt="{{ country.name.common }} emblem" class="img2">
<img src="{{ country.coatOfArms.svg }}" alt="{{ country.name.common }} {% trans 'emblem' %}"
class="img2">
{% endif %}
{% endwith %}
{% endif %}
{% if search_form.search_term.value %}
<p>Currency:
<p>{% trans 'Currency' %}:
{% if country.currencies %}
{% for currency_code, currency_info in country.currencies.items %}
{{ currency_info.name }}{% if not forloop.last %},{% endif %}
{% endfor %}
{% else %}
N/A
{% trans 'N/A' %}
{% endif %}
</p>
<p>Languages:
<p>{% trans 'Language' %}:
{% if country.languages %}
{% for language_code, language_name in country.languages.items %}
{{ language_name }}{% if not forloop.last %},{% endif %}
{% endfor %}
{% else %}
N/A
{% trans 'N/A' %}
{% endif %}
</p>
<p>Borders:
<p>{% trans 'Borders' %}:
{% if country.borders %}
{% for border_country_code in country.borders %}
{{ border_country_code }}{% if not forloop.last %},{% endif %}
{% endfor %}
{% else %}
N/A
{% trans 'N/A' %}
{% endif %}
</p>
<p>Area:
<p>{% trans 'Area' %}:
{% if country.area %}
{{ country.area }} km²
{% else %}
N/A
{% trans 'N/A' %}
{% endif %}
</p>
<p>Timezones:
<p>{% trans 'Timezones' %}:
{% if country.timezones %}
{% for timezone in country.timezones %}
{{ timezone }}{% if not forloop.last %},{% endif %}
{% endfor %}
{% else %}
N/A
{% trans 'N/A' %}
{% endif %}
</p>
<p>Top-level domain:
<p>{% trans 'Top-level domain' %}:
{% if country.tld %}
{{ country.tld.0 }}
{% else %}
N/A
{% trans 'N/A' %}
{% endif %}
</p>
{% endif %}
Expand All @@ -140,25 +143,26 @@ <h1 id="country-name">{{ country.name.common }}</h1>
{% with country.name.common|get_emblems_url as emblems %}
{% if emblems %}
<div class="emblem-card">
<img src="{{ emblems }}" alt="{{ country.name.common }} emblem" class="img3">
<img src="{{ emblems }}" alt="{{ country.name.common }} {% trans 'emblem' %}" class="img3">
</div>
{% elif country.coatOfArms %}
<div class="emblem-card">
<img src="{{ country.coatOfArms.svg }}" alt="{{ country.name.common }} emblem" class="img3">
<img src="{{ country.coatOfArms.svg }}" alt="{{ country.name.common }} {% trans 'emblem' %}"
class="img3">
</div>
{% endif %}
{% endwith %}
{% endif %}
{% if country.description %}
<div id="description-card">
<h1>ABOUT {{ country.name.common|upper }}:</h1>
<h1>{% trans 'ABOUT' %} {{ country.name.common|upper }}:</h1>
<p>{{ country.description }}</p>
</div>
{% endif %}
{% endfor %}
{% if not country_data %}
<div id="no-results">
<h1>No results found...</h1>
<h1>{% trans 'No results found...' %}</h1>
</div>
{% endif %}
</div>
Expand All @@ -167,12 +171,12 @@ <h1>No results found...</h1>
<div>
<p>© 2024 | Davide Presti</p>
<a class="link" href="https://github.com/davevad93" target="_blank">
<img src="{% static 'img/github-mark-white.png' %}" id="logo" alt="Link to my Github page."
title="Link to my Github page.">
<img src="{% static 'img/github-mark-white.png' %}" id="logo" alt="{% trans 'Link to my Github page.' %}"
title="{% trans 'Link to my Github page.' %}">
</a>
<a href="http://www.djangoproject.com/"><img
src="https://www.djangoproject.com/m/img/badges/djangomade124x25.gif" alt="Made with Django."
title="Made with Django." id="django"/></a>
src="https://www.djangoproject.com/m/img/badges/djangomade124x25.gif" alt="{% trans 'Made with Django.' %}"
title="{% trans 'Made with Django.' %}" id="django" /></a>
</div>
</footer>
</body>
Expand Down
Loading