Whenever possible, specify the language(s) of the document, of individual paragraphs and phrases while writing, in the text processing tool.
To specify the language of particular paragraphs and phrases in MS Word, OpenOffice, LibreOffice and similar tools, use appropriate language settings and keyboards while typing. To specify language(s) in an existing document, select the text and define the language using the Language tool in the toolbar or menu. To preserve this information after conversion to PDF, the document should be exported as a tagged PDF. However, depending on the PDF extension built in the text processor, this information may be lost during conversion to PDF.
W3C provides recommendations on how to specify the language for a passage or phrase with the Lang entry in PDF documents. However, in order to implement these recommendations in PDF files, commercial software, Adobe Acrobat is required.
Multilingual support is also provided for LaTeX. There are a number of packages enabling typesetting in different languages, e.g. https://ctan.org/pkg/babel?lang=en or polyglossia, and this feature is also available in Overleaf, collaborative cloud-based LaTeX editor
However, the interoperability of various text editing tools and formats used remains an open issue. Clear standards and collaboration with software produces is necessary to ensure that text created in various software tools remains not only readable for humans and machines, but also that the various features and functionalities (e.g. encoding, tags, annotations) available in the original document remain available after conversion to other formats.