Different files for multiple languages

Hi,

I’m quite new to Kirby CMS but am very pleased with it so far. I have a question thou; is there any plans to support different files for multiple languages?

What I mean is that I have a multilanguage setup with both english and swedish and I have pages that lets you upload a pdf file but when I (or the panel user) switch to the other language I want to be able to upload a different file for that language.

Is there any plans to support this or is it doable already?

Best regards,
Kristofer

There are I think two ways to solve this:

  • use different filenames which contain a language code; you can then either filter by that language code or assign different templates to these files.
  • use language specific subpages, e.g. files-en etc. and fetch files from there

It is not possible to upload files with the same filename into a single folder in the file system.

Thanks for the quick answer and the solutions!

I don’t like the idea that the panel users have to name their files in a certain way for it to work before uploading them. And I don’t think I get how I could do it in a way with subpages that is easy for the enduser to manage. Everything needs to be foolproof …

I found another way thou that pleased me more. :slight_smile:

With the new Upload/Add option enabled since 3.2.0 for fields/files the user can upload pdf-files in whichever language and then select the file that corresponds to the right language and it will be saved and associated in the page language txt file.

Could maybe a future solution for Kirby be to have subfolders for pages named as the language code and the files uploaded saved in there associated with the language so that the enduser only see the files for the choosen language?

Thanks again and keep up the good work!

Best regards,
Kristofer

If you keep the files separated in subfolders per language, you can use the files field query to query only those that apply to a given language.

Maybe conditional sections or fields can help as well, have to think about this some more. I actually think if you pre-fill a hidden field with the language code on page creation, then a conditional field or section based on this value could work.