Translation for files


I’m trying to upload a file per language in panel. That is to say if I upload a file in english, as I go in german, I have to upload a new file. For other fields it is done with translate option, but I don’t think this works for the files.

Than I thought about using checkboxes options for each file, so the user can chose the language himself. Unfortunately, I found no way to use the languages as options in a blueprint.

Has anyone a solution for me for any of this problem, or maybe a new way to achieve my goal?

Thank you for your help.

I’m afraid I don’t quite understand what you want to achieve. What sort of files are we talking about here? Language specific PDF files?

Yeah sorry for my poor english. Maybe the title is misleading too.
For example, I got a page where it is possible to download product catalogs. If I go on URL, a PDF of the catalog is available in english, but if I go on, the PDF should be in german.
So in my panel There is a catalog page on which the administrator can upload the PDF files. The question is how to tell Kirby that this file is the one needed when the page is in english, and the other one when it is in german?
So far the only solution I found was to detect the lang code in the file name in the frontend (e.g. catalog_en.pdf).
I am sure I am missing something obvious here.
Anyway thanks for your help.

If you use a separate field in your page form for the download link, the admin would have to choose the correct file for the language, i.e. the one with the language code for the page language. To make it easier for the admin, you could create a custom select field, where only the files for that particular language are listed.

Or the admin could just drag and drop the correct file into a text/textarea field.

Or you could just pull all files from the folder and filter them by language in your template. Then the admin would not have to do anything else than uploading the files.

$langCode = $site->language()->code();
foreach($page->files()->filterBy('filename', '*=', $langCode) as $file) {
 //do stuff

Like I said, obviously. I didn’t think to go through the form itself to solve the problem.
I’m not fond of the filter by name stuff. In fact there are like 10 languages in the website, and many redactors. I don’t want to impose a name convention, so each time they name it wrong they come to me to know why the website is broken…
So I went for the select option:

  type: select
    options: documents
      en: Catalog
      de: Kataloge

Thank you very much again for your help.