Skip to content

Commit

Permalink
test(folder): add some missing test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ultrabug committed Oct 5, 2023
1 parent 77ed64a commit 507cabc
Show file tree
Hide file tree
Showing 20 changed files with 761 additions and 35 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# English default fallback

This is the english version of a page that will show up on other languages as a fallback.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
121 changes: 121 additions & 0 deletions tests/docs_folder_structure_two_languages_with_default/en/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# Home page (default version + english version)

!!! tip
**Use the language switcher in the header** to switch between the localized versions of this demo website. This switcher is part of [mkdocs-material >= 7.1.0](https://squidfunk.github.io/mkdocs-material/setup/changing-the-language/#site-language-selector) and is **automatically configured by this plugin** or can be statically configured from the [mkdocs.yml file](https://github.com/ultrabug/mkdocs-static-i18n/blob/main/mkdocs.yml).

## What you are seeing now

This page source file and media content have been localized after applying
the [localized build logic](#localized-build-logic) described below. Here is a
quick recap of the files used as source and the generated build structure of
what you see:

```
docs
├── image.en.png <-- this image file is used here
├── image.fr.png
├── index.fr.md
├── index.md <-- this file is used here
├── topic1
│   ├── named_file.en.md
│   └── named_file.fr.md
└── topic2
├── index.en.md
└── index.md
```

```
site
├── en
│   ├── image.png <-- you see this image here on the /en version
│   ├── index.html <-- you are here on the /en version
│   ├── topic1
│   │   └── named_file
│   │   └── index.html
│   └── topic2
│   └── index.html
├── fr
│   ├── image.png
│   ├── index.html
│   ├── topic1
│   │   └── named_file
│   │   └── index.html
│   └── topic2
│   └── index.html
├── image.png <-- you see this image here on the default version
├── index.html <-- you are here on the default version
├── topic1
│   └── named_file
│   └── index.html
└── topic2
└── index.html
```

## Automatic media / link / asset localization

![localized image](image.png)

This image source is dynamically localized while still being referenced in the
markdown source of the page as `![localized image](image.png)`. This means that
this plugin allows you to not worry about links, media and static content file
names, just use their simple name and concentrate on your content translation!

Of course, images can also not be localized just like the image below which is
used by all versions of your pages:

![non localized image](assets/image_non_localized.png)

---

## Localized build logic

The settings used to build this site is:

```
plugins:
- i18n:
default_language: en
languages:
en: english
fr: français
```

Meaning that we will get three versions of our website:

1. the `default_language` version which will use any `.md` documentation file first and fallback to any `.en.md` file found since `en` is the default language
2. the `/en` language version which will use any `.en.md` documentation file first and fallback to any `.md` file found
3. the `/fr` language version which will use any `.fr.md` documentation file first and fallback to either `.en.md` file (default language) or `.md` file (default language fallback) whichever comes first

Given that logic, the following `site` structure is built:

```
site
├── 404.html
├── assets
│   ├── images
│   ├── javascripts
│   └── stylesheets
├── en
│   ├── image.png
│   ├── index.html
│   ├── topic1
│   │   └── named_file
│   │   └── index.html
│   └── topic2
│   └── index.html
├── fr
│   ├── image.png
│   ├── index.html
│   ├── topic1
│   │   └── named_file
│   │   └── index.html
│   └── topic2
│   └── index.html
├── image.png
├── index.html
├── topic1
│   └── named_file
│   └── index.html
└── topic2
└── index.html
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Topic 1 (default version + english version)

!!! tip
**Use the language switcher in the header** to switch between the localized versions of this demo website. This switcher is part of [mkdocs-material >= 7.1.0](https://squidfunk.github.io/mkdocs-material/setup/changing-the-language/#site-language-selector) and is **automatically configured by this plugin** or can be statically configured from the [mkdocs.yml file](https://github.com/ultrabug/mkdocs-static-i18n/blob/main/mkdocs.yml).

## What you are seeing now

This page source file and media content have been localized after applying
the [localized build logic](#localized-build-logic) described below. Here is a
quick recap of the files used as source and the generated build structure of
what you see:

```
docs
├── image.en.png <-- this image file is used on both the default and /en versions
├── image.fr.png
├── index.fr.md
├── index.md
├── topic1
│   ├── named_file.en.md <-- this file is used on both the default and /en versions
│   └── named_file.fr.md
└── topic2
├── index.en.md
└── index.md
```

```
site
├── en
│   ├── image.png <-- you see this image on the /en version
│   ├── index.html
│   ├── topic1
│   │   └── named_file
│   │   └── index.html <-- you are here on the /en version
│   └── topic2
│   └── index.html
├── fr
│   ├── image.png
│   ├── index.html
│   ├── topic1
│   │   └── named_file
│   │   └── index.html
│   └── topic2
│   └── index.html
├── image.png <-- you see this image on the default version
├── index.html
├── topic1
│   └── named_file
│   └── index.html <-- you are here on the default version
└── topic2
└── index.html
```

## Automatic media / link / asset localization

![localized image](../image.png)

This image source is dynamically localized while still being referenced in the
markdown source of the page as `![localized image](../image.png)`. This means that
this plugin allows you to not worry about links, media and static content file
names, just use their simple name and concentrate on your content translation!

---

## Localized build logic

The settings used to build this site is:

```
plugins:
- i18n:
default_language: en
languages:
en: english
fr: français
```

Meaning that we will get three versions of our website:

1. the `default_language` version which will use any `.md` documentation file first and fallback to any `.en.md` file found since `en` is the default language
2. the `/en` language version which will use any `.en.md` documentation file first and fallback to any `.md` file found
3. the `/fr` language version which will use any `.fr.md` documentation file first and fallback to either `.en.md` file (default language) or `.md` file (default language fallback) whichever comes first

Given that logic, the following `site` structure is built:

```
site
├── 404.html
├── assets
│   ├── images
│   ├── javascripts
│   └── stylesheets
├── en
│   ├── image.png
│   ├── index.html
│   ├── topic1
│   │   └── named_file
│   │   └── index.html
│   └── topic2
│   └── index.html
├── fr
│   ├── image.png
│   ├── index.html
│   ├── topic1
│   │   └── named_file
│   │   └── index.html
│   └── topic2
│   └── index.html
├── image.png
├── index.html
├── topic1
│   └── named_file
│   └── index.html
└── topic2
└── index.html
```
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Topic 2 (english version + french version)

!!! tip
**Use the language switcher in the header** to switch between the localized versions of this demo website. This switcher is part of [mkdocs-material >= 7.1.0](https://squidfunk.github.io/mkdocs-material/setup/changing-the-language/#site-language-selector) and is **automatically configured by this plugin** or can be statically configured from the [mkdocs.yml file](https://github.com/ultrabug/mkdocs-static-i18n/blob/main/mkdocs.yml).

## What you are seeing now

This page source file and media content have been localized after applying
the [localized build logic](#localized-build-logic) described below. Here is a
quick recap of the files used as source and the generated build structure of
what you see:

```
docs
├── image.en.png <-- this image file is used on the /en version
├── image.fr.png <-- this image file is used on the /fr version
├── index.fr.md
├── index.md
├── topic1
│   ├── named_file.en.md
│   └── named_file.fr.md
└── topic2
├── index.en.md <-- this file is used for both /en and /fr versions
└── index.md
```

```
site
├── en
│   ├── image.png <-- you see this image on the /en version
│   ├── index.html
│   ├── topic1
│   │   └── named_file
│   │   └── index.html
│   └── topic2
│   └── index.html <-- you are here on the /en version
├── fr
│   ├── image.png <-- you see this image on the /fr version
│   ├── index.html
│   ├── topic1
│   │   └── named_file
│   │   └── index.html
│   └── topic2
│   └── index.html <-- you are here on the /fr version
├── image.png
├── index.html
├── topic1
│   └── named_file
│   └── index.html
└── topic2
└── index.html
```

## Automatic media / link / asset localization

![localized image](../image.png)

This image source is dynamically localized while still being referenced in the
markdown source of the page as `![localized image](../image.png)`. This means that
this plugin allows you to not worry about links, media and static content file
names, just use their simple name and concentrate on your content translation!

---

## Localized build logic

The settings used to build this site is:

```
plugins:
- i18n:
default_language: en
languages:
en: english
fr: français
```

Meaning that we will get three versions of our website:

1. the `default_language` version which will use any `.md` documentation file first and fallback to any `.en.md` file found since `en` is the default language
2. the `/en` language version which will use any `.en.md` documentation file first and fallback to any `.md` file found
3. the `/fr` language version which will use any `.fr.md` documentation file first and fallback to either `.en.md` file (default language) or `.md` file (default language fallback) whichever comes first

Given that logic, the following `site` structure is built:

```
site
├── 404.html
├── assets
│   ├── images
│   ├── javascripts
│   └── stylesheets
├── en
│   ├── image.png
│   ├── index.html
│   ├── topic1
│   │   └── named_file
│   │   └── index.html
│   └── topic2
│   └── index.html
├── fr
│   ├── image.png
│   ├── index.html
│   ├── topic1
│   │   └── named_file
│   │   └── index.html
│   └── topic2
│   └── index.html
├── image.png
├── index.html
├── topic1
│   └── named_file
│   └── index.html
└── topic2
└── index.html
```
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This page only exists on the French version

Et voilà !
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 507cabc

Please sign in to comment.