mkdocs-static-i18n icon indicating copy to clipboard operation
mkdocs-static-i18n copied to clipboard

Non localized files missing in not default language

Open brospars opened this issue 2 years ago • 3 comments

I recently upgraded to the latest version of this plugin and some of my links are broken because non localized files are not copied in other languages :

docs_dir
├── index.fr.md
├── index.en.md
├── topic1
│   ├── custom_data_file.csv
│   ├── index.en.md
│   └── index.fr.md

Will do :

site
├── fr
│   ├── index.html
│   ├── topic1
│   │   ├── custom_data_file.csv
│   │   └── index.html
├── index.html
├── topic1
│   └── index.html

Where previsously it was :

site
├── fr
│   ├── index.html
│   ├── topic1
│   │   ├── custom_data_file.csv
│   │   └── index.html
├── index.html
├── topic1
│   ├── custom_data_file.csv
│   └── index.html

My custom_data_file.csv file was copied on both languages and I can link to it in my .pages but now it's not working anymore... I understand it's more efficient this way but is there a way to achieve that anyway ?

brospars avatar Feb 07 '24 10:02 brospars

Bonjour Benoit,

I'm surprised by what you're experiencing since you say your tree structure would build as

site
├── fr
│   ├── index.html
│   ├── topic1
│   │   ├── custom_data_file.csv
│   │   └── index.html
├── index.html
├── topic1
│   └── index.html

but in my understanding it should build as

site
├── fr
│   ├── index.html
│   └── topic1
│       └── index.html
├── index.html
└── topic1
    ├── custom_data_file.csv
    └── index.html

Unless your mkdocs.yml says differently? Could you share it?

ultrabug avatar Feb 27 '24 11:02 ultrabug

Hello, Yes my bad I modified it to simplify and made a mistake.

But another related problem is that sometimes images are inserted using html like so :

<figure>
  <img src="Images/TitreActivite.png" alt="Image alt" />
  <figcaption>Image caption</figcaption>
</figure>

with the following structure :

docs_dir
├── index.fr.md
├── index.en.md
├── Images
│   └── TitreActivite.png
site
├── fr
│   ├── index.html
├── index.html
└── Images
    └── TitreActivite.png

So images will work in the default language but not in the others...

brospars avatar Mar 20 '24 10:03 brospars

Try using the markdown in html extension and use it like the example here: https://squidfunk.github.io/mkdocs-material/reference/images/#image-captions

If you have to use HTML tags then use absolute paths starting with a / or /prefix from your site_url if you're hosting the page on GitHub Pages.

kamilkrzyskow avatar Mar 20 '24 22:03 kamilkrzyskow