Jump to content

Recommended Posts

Posted

Hi,

I was making a multi language site with download section that would automatically list files based on language. I was going to check if $file->description had any content on current language, but this does not work as it always returns the default language even when different language is selected.

Example:

Site has three languages, english (default), french and german.

document_en.pdf | en desc "lorem ipsum" | fr desc "" | de desc ""

document_fr.pdf | en desc "" | fr desc "lorem ipsum" | de desc ""

document_de.pdf | en desc "" | fr desc "" | de desc "lorem ipsum"

It would iterate through all of these and only return the documents that had description in current language.

Problem is it will always return document_en.pdf no matter which language is selected. For french and german it correctly only shows them according to the language.

Currently using PW version 3.0.95.

 

Posted

Hi @Hurme,

this would be an ideal use case for language-alternate fields, if you haven‘t heard of them.?

Or if you dont‘ want to use them, you could try to disable, that if no translation exists, the default language will be used.

But language-alternate fields would be better.

Regards, Andreas

  • Like 2
  • Thanks 1
Posted

Hi,

I solved the issue by making using the tags option in the files field and by disabling the multi language description altogether. I had read about the language-alternate fields, but had forgotten about them by the time I was doing this site. So cheers for the reminder. ?

I still think the file fields description is behaving in a not so logical way. Luckily it's a problem you can easily get around in multiple ways.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...