Skip to content

Commit

Permalink
Merge pull request #24 from mastogros/translation_fr
Browse files Browse the repository at this point in the history
i18n for public website and documentation and French translation of existing doc
  • Loading branch information
viktorstrate committed Mar 12, 2022
2 parents c77454a + 04151aa commit 9bb5ef2
Show file tree
Hide file tree
Showing 77 changed files with 1,437 additions and 47 deletions.
4 changes: 2 additions & 2 deletions src/404.njk
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ permalink: /404.html
<h1>Page not found</h1>
<p>The page you requested doesn't exist, go back to the <a href="/">landing page</a></p>
</main>

<script>plausible("404",{ props: { path: document.location.pathname } });</script>
</body>
</html>
</html>
12 changes: 12 additions & 0 deletions src/_data/languages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
languages: [
{
label: "English",
code: "en",
},
{
label: "Français",
code: "fr",
},
],
};
60 changes: 33 additions & 27 deletions src/_includes/docs/layout.njk
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,26 @@
<nav class="mb-8">
<ul>

{%- for entry in "root" | docsNavGroupItems(collections.all) %}
{{ navEntryItem(entry) }}
{%- endfor %}

{%- for group in navGroups %}
<li class="">
<span class="ml-3 mt-6 block uppercase text-gray-600 font-bold text-xs tracking-wider">{{ group }}</span>

<ul>
{%- for entry in group | docsNavGroupItems(collections.all) %}
{{ navEntryItem(entry) }}
{%- endfor %}
</ul>

</li>
{%- endfor %}

{%- for entry in "root" | docsNavGroupItems(collections.all) %}
{%- if entry.data.locale == locale %}
{{ navEntryItem(entry) }}
{%- endif %}
{%- endfor %}

{%- for group in navGroups %}
<li class="">
<span class="ml-3 mt-6 block uppercase text-gray-600 font-bold text-xs tracking-wider">{{ group }}</span>

<ul>
{%- for entry in group | docsNavGroupItems(collections.all) %}
{%- if entry.data.locale == locale %}
{{ navEntryItem(entry) }}
{%- endif %}
{%- endfor %}
</ul>

</li>
{%- endfor %}
</ul>
</nav>

Expand All @@ -77,22 +80,25 @@
</style>

<aside id="content-toc" class="w-48 sticky docs-toc order-3 flex-shrink-0">
<span class="block uppercase text-gray-600 font-bold text-xs tracking-wider pt-0">Contents</span>
{{ content | toc | safe }}
<span class="block uppercase text-gray-600 font-bold text-xs tracking-wider pt-0">Contents</span>
{{ content | toc | safe }}
</aside>

<main id="primary-content" class="mb-40 w-full px-14 py-14">

<header class="flex justify-between items-center">
<h1>{{ title }}</h1>
<a title="Edit on GitHub"
class="text-gray-500 hover:text-primaryDark no-underline"
href="https://github.com/photoview/photoview.github.io/edit/master/{{ page.inputPath }}">

<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-3"><path d="M12 20h9"></path>
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg>
</a>
<div class="flex items-center">
<a title="Edit on GitHub"
class="text-gray-500 hover:text-primaryDark no-underline"
href="https://github.com/photoview/photoview.github.io/edit/master/{{ page.inputPath }}">

<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
stroke-linecap="round" stroke-linejoin="round" class="feather feather-edit-3"><path d="M12 20h9"></path>
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"></path></svg>
</a>
{% include 'languages-switcher.njk' %}
</div>
</header>

{{ content | safe }}
Expand Down
5 changes: 4 additions & 1 deletion src/_includes/header.njk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</a>
</span>
<ul class="flex h-full items-center">
<li class=""><a class="text-black hover:text-black no-underline hover:underline" href="{{ '/docs' | url }}">Documentation</a></li>
<li class=""><a class="text-black hover:text-black no-underline hover:underline" href="{{ '/' + (locale if locale else "en") + '/docs' | url }}">Documentation</a></li>
<li class="ml-8">
<a class="font-thin flex items-center hover:underline" href="{{ 'https://github.com/photoview/photoview' | url }}">

Expand All @@ -18,6 +18,9 @@

</a>
</li>
<li>
{% include 'languages-switcher.njk' %}
</li>
</ul>
</nav>
</div>
Expand Down
29 changes: 29 additions & 0 deletions src/_includes/languages-switcher.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% if translationKey %}
{% set translatedUrl = "" %}
{% for lg in languages.languages %}
{% if loop.first %}
<select class="ml-5" id="lg-switcher" onchange="changeLanguage()">
{% endif %}

{% for item in collections.all %}
{% if translatedUrl == "" and item.data.translationKey == translationKey and item.data.locale == lg.code %}
{% set translatedUrl = item.url %}
{% endif %}
{% endfor %}

<option class="lg-switcher-item" {% if lg.code == locale %} selected="selected" {% endif %} value="{{ translatedUrl }}">
{{ lg.label }}
</option>

{% if loop.last %}
</select>
{% endif %}
{% set translatedUrl = "" %}
{% endfor %}

<script>
function changeLanguage() {
document.location.href=document.getElementById("lg-switcher").value;
}
</script>
{% endif %}
13 changes: 13 additions & 0 deletions src/_includes/redirect-layout.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Photoview - Redirecting...</title>
<link rel="canonical" href="https://photoview.github.io{{ target }}"/>
<meta http-equiv="refresh" content="0;url={{ target }}" />
</head>
<body>
<h1>Redirecting to the new page location...</h1>
<a href="{{ target }}">Click here if you are not redirected.<a>
</body>
</html>
6 changes: 6 additions & 0 deletions src/_redirections/docs/contribute-feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/contribute-feature-request/
target: '/en/docs/contribute-feature-request/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/contribute-how-to.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/contribute-how-to/
target: '/en/docs/contribute-how-to/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/contribute-setup-locally.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/contribute-setup-locally/
target: '/en/docs/contribute-setup-locally/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/faq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/faq/
target: '/en/docs/faq/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/getting-started/
target: '/en/docs/getting-started/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/installation-docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/installation-docker/
target: '/en/docs/installation-docker/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/installation-environment-variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/installation-environment-variables/
target: '/en/docs/installation-environment-variables/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/installation-manual.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/installation-manual/
target: '/en/docs/installation-manual/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/installation-reverse-proxies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/installation-reverse-proxies/
target: '/en/docs/installation-reverse-proxies/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/installation-systemd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/installation-systemd/
target: '/en/docs/installation-systemd/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/
target: '/en/docs/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/usage-basic-overview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/usage-basic-overview/
target: '/en/docs/usage-basic-overview/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/usage-nextcloud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/usage-nextcloud/
target: '/en/docs/usage-nextcloud/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/usage-people.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/usage-people/
target: '/en/docs/usage-people/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/usage-places.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/usage-places/
target: '/en/docs/usage-places/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/usage-scanner.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/usage-scanner/
target: '/en/docs/usage-scanner/'
sitemap: false
---
6 changes: 6 additions & 0 deletions src/_redirections/docs/usage-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /docs/usage-settings/
target: '/en/docs/usage-settings/'
sitemap: false
---
13 changes: 13 additions & 0 deletions src/_redirections/docs/usage-sharing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
layout: 'redirect-layout'
permalink: /docs/usage-sharing/
target: '/en/docs/usage-sharing/'
sitemap: false
---
---
title: Share albums and media
group: Usage
translationKey: usage-sharing
---

> TODO: Explain how to share albums and media, how to set a password and how to delete them again
6 changes: 6 additions & 0 deletions src/_redirections/en-home-redirection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
layout: 'redirect-layout'
permalink: /en/
target: '/'
sitemap: false
---
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Reporting bugs
group: Contributing
translationKey: contribute-feature-request
---

If you have found a bug please open a [new issue](https://github.com/photoview/photoview/issues/new).
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: How to contribute
group: Contributing
priority: 1
translationKey: contribute-how-to
---

## Different ways to contribute
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Setup Development Environment
group: Contributing
translationKey: contribute-setup-locally
---

How to set up a development environment locally.
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions src/docs/faq.md → src/en/docs/faq.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: FAQ
group: root
translationKey: faq
---

## Move cache to another hard drive?
Expand Down Expand Up @@ -30,7 +31,7 @@ In this case, you will also likely want to remove your database.

## I click "Scan All" but nothing happens

If you are using Docker, make sure that your media is properly mounted. If you are unsure about that see [Setup with Docker](/docs/installation-docker/).
If you are using Docker, make sure that your media is properly mounted. If you are unsure about that see [Setup with Docker](/{{ locale }}/docs/installation-docker/).

To troubleshoot this, you can enter the container and check that the media is present.
To do this execute the following command `docker-compose exec -it photoview /bin/bash`, then list the mounted directory with `ls /photos`.
Expand All @@ -44,7 +45,7 @@ Failed to begin database transaction: failed to process photo: &lt;...&gt;: sign
```

This error is thrown if the server doesn't have enough resources to process the media, and the operating system kills some worker processes to free up resources.
To circumvent that, you can reduce the number of [concurrent workers](/docs/usage-settings/#concurrent-workers).
To circumvent that, you can reduce the number of [concurrent workers](/{{ locale }}/docs/usage-settings/#concurrent-workers).
Try setting it to `1` and see if that fixes the problem.

## Where do I find logging information
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: Getting Started
group: root
priority: 2
translationKey: getting-started
---

_Get Photoview up and running as quickly as possible_
Expand All @@ -16,7 +17,7 @@ Make a new `docker-compose.yml` file, and copy the content of [docker-compose.ex

Edit `docker-compose.yml`, find the comments starting with `Change This:`, and change the values, to properly match your setup. If you are just testing locally, you don't have to change anything.

For more details see [Setup with Docker](/docs/installation-docker/)
For more details see [Setup with Docker](/en/docs/installation-docker/)

## Starting the server

Expand Down
File renamed without changes
Loading

0 comments on commit 9bb5ef2

Please sign in to comment.