Jump to content

Multi-language PDF files


adrian
 Share

Recommended Posts

What do you guys do about multi-language versions of PDF documents stored in a files field? I want the correct language version of each doc served on the frontend based on the language selected by the user. Do I make use of the Language alternate fields in this case, or do you guys upload different versions to the one files field and have some sort of naming convention, eg "mypdfname_dutch.pdf" etc and then add the logic via the template API to server the correct version?

Thanks for any advice.

  • Like 1
Link to comment
Share on other sites

Thanks - I understand that when using "language alternate fields" it automatically used the field based on the language name in the "_suffix" but are you saying it also works if I had two pdfs in the one files field named: "mypdfname.pdf and "mypdfname_portugues.pdf" - so if the user has selected the default English they will get the first one and if they select the dutch language the second one will be automatically linked to instead? I just did some basic testing and I don't see it functioning that way.

What does work (and what I assumed I would have to do if I upload all language versions to the one files field), is this:

$page->document_pdf->get("name*=portugues")->url

obviously replacing "portugues" with the current language.

Am I missing some other way to do this?

I am actually thinking that separate language alternate fields will probably be easier for the site editors, but I am still curious to know if there is a different approach I am missing.

  • Like 2
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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