treewide: add translation changes

This commit is contained in:
lifehackerhansol 2024-01-13 10:10:00 -08:00
parent 73637c752f
commit c9a71194bf
No known key found for this signature in database
GPG key ID: 80FB184AFC0B3B0E
6 changed files with 157 additions and 24 deletions

View file

@ -16,12 +16,24 @@
-->
<!-- hacks-guide change end -->
<ul class="visible-links">
{%- for link in site.data.navigation.main -%}
<li class="masthead__menu-item">
<a href="{{ link.url | relative_url }}"{% if link.description %} title="{{ link.description }}"{% endif %}>{{ link.title }}</a>
</li>
{%- endfor -%}
</ul>
<!-- hacks-guide change start: multi-language configuration -->
{% assign split_path = page.path | split: "/" %}
{% assign locale = split_path[1] %}
{% assign titles = site.data.navigation[locale].main %}
{% if locale == 'en_US' %}
{% assign locale_var = '/' %}
{% else %}
{% assign locale_var = locale | prepend:'/' | append:'/' %}
{% endif %}
{% for link in site.data.navigation[locale].main %}
{% if link.url == "/" %}
<li class="masthead__menu-item masthead__menu-item--lg"><a href="{{ domain }}{{ locale_var }}">{{ link.title }}</a></li>
{% else %}
<li class="masthead__menu-item"><a href="{{ domain }}{{ locale_var }}{{ link.url }}">{{ link.title }}</a></li>
{% endif %}
{% endfor %}
<!-- hacks-guide change end -->
{% if site.search == true %}
<button class="search__toggle" type="button">
<span class="visually-hidden">{{ site.data.ui-text[site.locale].search_label | default: "Toggle search" }}</span>

View file

@ -1,26 +1,34 @@
{% assign navigation = site.data.navigation[include.nav] %}
<!-- hacks-guide change start: Refactor entire subsection to allow using translations -->
{% assign split_path = page.path | split: "/" %}
{% assign locale = split_path[1] %}
{% if locale == 'en_US' %}
{% assign locale_var = '/' %}
{% else %}
{% assign locale_var = locale | prepend:'/' | append:'/' %}
{% endif %}
{% assign title = site.data.navigation[locale].sidebar_title %}
{% assign navigation = site.data.navigation[locale].sidebar_pages %}
<nav class="nav__list">
{% if page.sidebar.title %}<h3 class="nav__title" style="padding-left: 0;">{{ page.sidebar.title }}</h3>{% endif %}
<input id="ac-toc" name="accordion-toc" type="checkbox" />
<label for="ac-toc">{{ site.data.ui-text[site.locale].menu_label | default: "Toggle Menu" }}</label>
<ul class="nav__items">
{% for nav in navigation %}
<li>
{% if nav.url %}
<a href="{{ nav.url | relative_url }}"><span class="nav__sub-title">{{ nav.title }}</span></a>
{% else %}
<span class="nav__sub-title">{{ nav.title }}</span>
{% endif %}
{% if nav.children != null %}
<ul>
{% for child in nav.children %}
<li><a href="{{ child.url | relative_url }}"{% if child.url == page.url %} class="active"{% endif %}>{{ child.title }}</a></li>
{% endfor %}
</ul>
{% endif %}
</li>
{% endfor %}
<li>
<span class="nav__sub-title">{{ title[0].title }}</span>
<ol>
{% for link in site.data.navigation[locale].sidebar_pages %}
{% if link.url == "/" %}
<li style="display: none;" data-name="home"><a href='{{ domain }}{{ locale_var }}'>{{ link.title }}</a></li>
{% elsif link.url == "multiple-options" %}
<li style="display: none;" data-name="multiple-options"><i>({{ link.title }})</i></li>
{% else %}
<li style="display: none;" data-name="{{ site.data.navigation.en_US.sidebar_pages[forloop.index0].url }}"><a href='{{ domain }}{{ locale_var }}{{ link.url }}'>{{ link.title }}</a></li>
{% endif %}
{% endfor %}
</ol>
</li>
</ul>
</nav>
<!-- hacks-guide change end -->

View file

@ -40,6 +40,24 @@ layout: default
</nav>
</aside>
{% endif %}
<!-- hacks-guide change start -->
<hr>
{% assign split_path = page.path | split: "/" %}
{% assign locale = split_path[1] %}
{% for link in site.data.navigation[locale].bottom %}
{% if link.url contains 'http' %}
{% assign domain = '' %}
{% else %}
{% assign domain = site.url | append: site.baseurl %}
{% endif %}
<div class ="notice"><b>{{ link.title }}</b></div>
{% endfor %}
<hr>
<!-- hacks-guide change end -->
{{ content }}
{% if page.link %}<div><a href="{{ page.link }}" class="btn btn--primary">{{ site.data.ui-text[site.locale].ext_link_label | default: "Direct Link" }}</a></div>{% endif %}
</section>

View file

@ -16,6 +16,24 @@ layout: default
{% if page.last_modified_at %}<meta itemprop="dateModified" content="{{ page.last_modified_at | date_to_xmlschema }}">{% endif %}
<section class="page__content" itemprop="text">
<!-- hacks-guide change start -->
<hr>
{% assign split_path = page.path | split: "/" %}
{% assign locale = split_path[1] %}
{% for link in site.data.navigation[locale].bottom %}
{% if link.url contains 'http' %}
{% assign domain = '' %}
{% else %}
{% assign domain = site.url | append: site.baseurl %}
{% endif %}
<div class ="notice"><b>{{ link.title }}</b></div>
{% endfor %}
<hr>
<!-- hacks-guide change end -->
{{ content }}
</section>
</article>

View file

@ -216,6 +216,18 @@
cursor: pointer;
}
/* hacks-guide change start: add language selector */
&__toggle_lang {
-ms-flex-item-align: center;
align-self: center;
height: $nav-toggle-height;
border: 0;
outline: none;
background-color: transparent;
cursor: pointer;
}
/* hacks-guide change end */
.visible-links {
display: -webkit-box;
display: -ms-flexbox;

View file

@ -591,3 +591,68 @@ a.reversefootnote {
position: static;
}
}
/* hacks-guide change start: Add language selector */
/*
Langicons
========================================================================== */
.langicon {
position: relative;
width: $navicon-width;
display: inline-block;
background: transparent;
margin: auto;
color: $text-color;
&:before,
&:after {
content: "";
position: absolute;
left: 0;
width: $navicon-width;
height: $navicon-height;
background: $text-color;
display: none;
}
&:before {
top: (-2 * $navicon-height);
}
&:after {
bottom: (-2 * $navicon-height);
}
}
.close .langicon {
/* hide the middle line*/
background: transparent;
.fa-language {
display: none;
-webkit-transition: 0.3s;
transition: 0.3s;
}
/* overlay the lines by setting both their top values to 0*/
&:before, &:after{
-webkit-transform-origin: 50% 50%;
-ms-transform-origin: 50% 50%;
transform-origin: 50% 50%;
width: $navicon-width;
display: inherit;
}
/* rotate the lines to form the x shape*/
&:before{
-webkit-transform: rotate3d(0,0,1,45deg);
transform: rotate3d(0,0,1,45deg);
}
&:after{
top: (-2 * $navicon-height);
-webkit-transform: rotate3d(0,0,1,-45deg);
transform: rotate3d(0,0,1,-45deg);
}
}
/* hacks-guide change end */