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 --> <!-- hacks-guide change end -->
<ul class="visible-links"> <ul class="visible-links">
{%- for link in site.data.navigation.main -%} <!-- hacks-guide change start: multi-language configuration -->
<li class="masthead__menu-item"> {% assign split_path = page.path | split: "/" %}
<a href="{{ link.url | relative_url }}"{% if link.description %} title="{{ link.description }}"{% endif %}>{{ link.title }}</a> {% assign locale = split_path[1] %}
</li> {% assign titles = site.data.navigation[locale].main %}
{%- endfor -%} {% if locale == 'en_US' %}
</ul> {% 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 %} {% if site.search == true %}
<button class="search__toggle" type="button"> <button class="search__toggle" type="button">
<span class="visually-hidden">{{ site.data.ui-text[site.locale].search_label | default: "Toggle search" }}</span> <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"> <nav class="nav__list">
{% if page.sidebar.title %}<h3 class="nav__title" style="padding-left: 0;">{{ page.sidebar.title }}</h3>{% endif %} {% 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" /> <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> <label for="ac-toc">{{ site.data.ui-text[site.locale].menu_label | default: "Toggle Menu" }}</label>
<ul class="nav__items"> <ul class="nav__items">
{% for nav in navigation %} <li>
<li> <span class="nav__sub-title">{{ title[0].title }}</span>
{% if nav.url %} <ol>
<a href="{{ nav.url | relative_url }}"><span class="nav__sub-title">{{ nav.title }}</span></a> {% for link in site.data.navigation[locale].sidebar_pages %}
{% else %} {% if link.url == "/" %}
<span class="nav__sub-title">{{ nav.title }}</span> <li style="display: none;" data-name="home"><a href='{{ domain }}{{ locale_var }}'>{{ link.title }}</a></li>
{% endif %} {% elsif link.url == "multiple-options" %}
<li style="display: none;" data-name="multiple-options"><i>({{ link.title }})</i></li>
{% if nav.children != null %} {% else %}
<ul> <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>
{% for child in nav.children %} {% endif %}
<li><a href="{{ child.url | relative_url }}"{% if child.url == page.url %} class="active"{% endif %}>{{ child.title }}</a></li> {% endfor %}
{% endfor %} </ol>
</ul> </li>
{% endif %}
</li>
{% endfor %}
</ul> </ul>
</nav> </nav>
<!-- hacks-guide change end -->

View file

@ -40,6 +40,24 @@ layout: default
</nav> </nav>
</aside> </aside>
{% endif %} {% 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 }} {{ 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 %} {% 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> </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 %} {% if page.last_modified_at %}<meta itemprop="dateModified" content="{{ page.last_modified_at | date_to_xmlschema }}">{% endif %}
<section class="page__content" itemprop="text"> <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 }} {{ content }}
</section> </section>
</article> </article>

View file

@ -216,6 +216,18 @@
cursor: pointer; 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 { .visible-links {
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;

View file

@ -591,3 +591,68 @@ a.reversefootnote {
position: static; 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 */