adrian Posted September 14, 2016 Share Posted September 14, 2016 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. 1 Link to comment Share on other sites More sharing options...
LostKobrakai Posted September 14, 2016 Share Posted September 14, 2016 I think it's mostly a workflow issue. Both depend on a "magic string" to match the language to the file, therefore I'd say do what does fit best. 1 Link to comment Share on other sites More sharing options...
adrian Posted September 14, 2016 Author Share Posted September 14, 2016 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. 2 Link to comment Share on other sites More sharing options...
LostKobrakai Posted September 14, 2016 Share Posted September 14, 2016 Using only a single field is not possible automatically, but as you put, quite easy to achieve manually. That's why I meant you should probably decide based on the needed workflow rather than if it's automatic or not. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now