Using keys as links to external PDF files - profiling based on language

Post here questions and problems related to editing and publishing DITA content.
petrht
Posts: 4
Joined: Tue Jun 04, 2024 1:27 pm

Using keys as links to external PDF files - profiling based on language

Post by petrht »

Hello,

In our company, we use keys as references to external PDF files (COTS) via clickable links. But now we are in a situation where some of the external PDF files are in different languages and when translating the documentation e.g. into German, we would need to use a referential document (COTS) in that particular language. Is it possible to set the key to modify the pdf reference link according to the language of the ditamap that is published?

For example, we have two pdf files:
HPserver_en
HPserver_ger

According to the ditamap language setting (either en or ger), the correct link would then be selected, so the GER documentation would contain a link to the GER pdf.

I understand this could be done also with the DITAVAL file via setting both keys with audience parameter (en or ger) and the DITAVAL file would exclude one of them. However, this requires setting the audience parameter for each key manually.

Isn't there any workaround how to make this easy?

Thanks a lot for your time!

Petr
julien_lacour
Posts: 544
Joined: Wed Oct 16, 2019 3:47 pm

Re: Using keys as links to external PDF files - profiling based on language

Post by julien_lacour »

Hello Petr,

If you are using a ditamap for each language you can directly edit the key to either use HPserver_en or HPserver_ger PDF file.
You could use a ditaval file but this means you have both English and German version in the same ditamap which isn't practical to edit.

Regards,
Julien
petrht
Posts: 4
Joined: Tue Jun 04, 2024 1:27 pm

Re: Using keys as links to external PDF files - profiling based on language

Post by petrht »

Hello Julien,

yes, we have separate ditamap for each language, the ideal solution would be to have two separate folders under each language, but the problem is that there are also multilingual pdf documents (so in some cases, there is no EN or GER version, but only single document), so we just wanted to make sure whether there isn't any alternative solution with one folder with all the pdf documents via the structure of the code of key (something like the one below, which does not work).

<keydef keys="HPserver_ger" href="../Users/pzk/Desktop/HPserver_ger.pdf" format="pdf"
scope="external" xml:lang="ger" audience="ger"/>

So I suppose the best solution is to simply have two separate folders where multilingual pdf documents are doubled.

Thanks
petr
julien_lacour
Posts: 544
Joined: Wed Oct 16, 2019 3:47 pm

Re: Using keys as links to external PDF files - profiling based on language

Post by julien_lacour »

Hello Petr,

If you have separate ditamap for each language, a good practice could be to group the PDF into a resources folder (or several folders if there are a lot of PDFs) placed inside the ditamap folders hierarchy and then refer the file(s) into the ditamap with processing-role:

Code: Select all

<keydef keys="HPserver_ger" href="resources/HPserver_ger.pdf" format="pdf" processing-role="resource-only"/>
In this case you don't need to set a scope, as the default scope is "local" and the file will be copied into the transformation(s) output folder.
You cannot set external scope in this use-case because this means the PDF file is always stored at ../Users/pzk/Desktop/HPserver_ger.pdf (which I assume will not be the case).

If your files are stored in a web server you can directly refer them with external scope:

Code: Select all

<keydef keys="HPserver_ger" href="http://www.oxygenxml/HPserver_ger.pdf" format="pdf" scope="external"/>
Regards,
Julien
Post Reply