website/templates/faq/embedded-faq.html
Alexander Borsuk ae1d158c69
[faq] Add tracks recording in background section troubleshooting (#259)
* [faq] Add tracks in background section

Signed-off-by: Alexander Borsuk <me@alex.bio>

* Review fixes

Signed-off-by: Alexander Borsuk <me@alex.bio>

* Add new FAQ section into embedded FAQ page

Signed-off-by: Alexander Borsuk <me@alex.bio>

---------

Signed-off-by: Alexander Borsuk <me@alex.bio>
2024-10-09 23:22:07 +03:00

213 lines
No EOL
6.5 KiB
HTML

{#- List of questions -#}
{%- set faq_questions_en = [
"map/how-to-create-a-route",
"editing/map-errors",
"map/can-not-find-position",
"map/cant-download-maps",
"map/search-cannot-find-a-place",
"app/crash",
"voice/cant-hear-instructions",
"bookmarks/how-to-export",
"bookmarks/how-to-import",
"bookmarks/android-track-recording"
] -%}
{%- set faq_languages = ["ru", "de", "es", "fr", "pl", "pt", "pt-BR", "tr", "uk", "zh-Hans"] %} {# Predefined list of
translation languages -#}
<!DOCTYPE html>
<html>
<head>
<title>Organic Maps: Frequently Asked Questions</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<style>
/* All langs are invisible by default. */
[lang] {
display: none;
}
/* Dark mode support. */
:root {
color-scheme: light dark;
--primary-color: black;
--secondary-color: #555555;
--link-color: #1e96f0;
--background-color: white;
--separator-color: #0e0e0e;
}
@media screen and (prefers-color-scheme: dark) {
:root {
--primary-color: #b5b5b5;
--secondary-color: #858585;
--link-color: #2ea6ff;
--background-color: black;
--separator-color: #0a0a0a;
}
}
h3 {
font-style: normal;
font-weight: bold;
font-size: 18px;
line-height: 1.4;
}
dd {
margin-top: 0.5em;
margin-right: 0;
margin-left: 0;
margin-bottom: 16px;
font-size: 16px;
color: var(--secondary-color);
line-height: 1.4;
padding-bottom: 24px;
border-bottom: 1px solid var(--separator-color);
}
.faq {
border-bottom: 1px solid var(--separator-color);
}
dl {
margin: 0 0 2em 0;
}
html {
color: var(--primary-color);
background-color: var(--background-color);
}
body {
margin-right: 16px;
margin-left: 16px;
margin-bottom: 16px;
font-size: 16px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
}
html {
-webkit-text-size-adjust: none;
}
a {
color: var(--link-color);
text-decoration: none;
}
</style>
<script>
"use strict";
function getLanguage() {
var lang = navigator.language || navigator.userLanguage;
var found = location.href.indexOf("?");
if (found != -1) {
var urlParams = new URLSearchParams(location.href.substr(found));
var queryLang = urlParams.get("lang");
if (queryLang) lang = queryLang;
}
return lang;
}
// TODO: Update this list with new translations.
var translations = ['en', '{{ faq_languages | join(sep="', '") | replace(from="-Hans", to="") | safe}}'];
// Show Russian for browsers with these language codes.
var canReadRussian = ['ab', 'be', 'kk', 'ky', 'tg', 'uz'];
// TODO: Properly handle be-EN, he-RU or similar cases.
function showLanguage() {
var lang = getLanguage();
var iso6391 = lang.substring(0, 2);
if (canReadRussian.indexOf(iso6391) >= 0) // Array.includes is not supported in Android 5 and 6.
lang = 'ru';
else if (translations.indexOf(iso6391) >= 0) {
if (lang != 'pt-BR')
lang = iso6391;
} else
lang = 'en';
var elems = document.querySelectorAll('[lang="' + lang + '"]');
// Make them visible.
for (var i = 0; i < elems.length; ++i) elems[i].style.display = "block";
}
</script>
</head>
<body onload="showLanguage()">
<div class="faq">
<h2 lang="en">FAQ</h2>
<h2 lang="ru">Часто задаваемые вопросы (FAQ)</h2>
<h2 lang="de">FAQ</h2>
<h2 lang="es">FAQ</h2>
<h2 lang="fr">FAQ</h2>
<h2 lang="pt">Perguntas frequentes</h2>
<h2 lang="pt-BR">Perguntas frequentes</h2>
<h2 lang="pl">FAQ</h2>
<h2 lang="tr">SSS</h2>
<h2 lang="uk">Часті питання</h2>
<h2 lang="zh">常见问题</h2>
<ul>
{% for faq_slug in faq_questions_en -%}
{% set faq_page_en = get_page(path = "faq/" ~ faq_slug ~ "/index.md") -%}
{% set faq_slug = faq_slug | replace(from="/", to="-") -%}
<li class="link">
<a lang="en" href="#{{ faq_slug }}">{{ faq_page_en.title }}</a>
{#- Add translated pages -#}
{% for lang in faq_languages -%}
{% set translated_faq_page = faq_page_en.translations | filter(attribute="lang", value=lang) | first -%}
{% if not translated_faq_page -%}
{{ throw(message="Page 'faq/" ~ faq_slug ~ "/index.md' is not translated into '" ~ lang ~ "'") -}}
{%- endif %}
<a lang="{{ lang | replace(from="-Hans", to="") }}" href="#{{ faq_slug }}">{{ translated_faq_page.title }}</a>
{%- endfor %}
</li>
{% endfor %}
</ul>
<h4 lang="en">
{{ trans(key="more-info-om", lang="en") }} <a href="https://organicmaps.app/">organicmaps.app</a>
</h4>
{% for lang in faq_languages %}
<h4 lang="{{ lang | replace(from="-Hans", to="" ) }}">
{{ trans(key="more-info-om", lang=lang) }} <a href="https://organicmaps.app/{{ lang }}/">organicmaps.app</a>
</h4>
{%- endfor %}
</div>
{% for faq_slug in faq_questions_en -%}
{% set faq_page_en = get_page(path = "faq/" ~ faq_slug ~ "/index.md") -%}
<dl id="{{ faq_slug | replace(from="/", to="-" ) }}">
<dt>
<h3 lang="en">{{ faq_page_en.title }}</h3>
{# Add translations -#}
{% for lang in faq_languages -%}
{%- set translated_faq_page = faq_page_en.translations | filter(attribute="lang", value=lang) | first %}
<h3 lang="{{ lang | replace(from="-Hans", to="" ) }}">{{ translated_faq_page.title }}</h3>
{%- endfor %}
</dt>
<dd lang="en">
{{ faq_page_en.content | safe -}}
</dd>
{# Add translations -#}
{% for lang in faq_languages -%}
{% set translated_faq_page = faq_page_en.translations | filter(attribute="lang", value=lang) | first -%}
{% set translated_faq_page = get_page(path=translated_faq_page.path) -%}
<dd lang="{{ lang | replace(from="-Hans", to="" ) }}">
{{ translated_faq_page.content | safe }}
</dd>
{%- endfor %}
</dl>
{%- endfor %}
<a href="#" lang="en">{{ trans(key="go-to-top", lang="en") }}</a>
{% for lang in faq_languages -%}
<a href="#" lang="{{ lang | replace(from="-Hans", to="" ) }}">{{ trans(key="go-to-top", lang=lang) }}</a>
{% endfor %}
</body>
</html>