Hi. How can we help?

Language overrides

Last updated: 19 December 2023

DOCman provides you with the capability to write your own translation overrides without having to rely on modifying the core translation files. This is very convenient as otherwise you would have to make your translations changes every single time you update DOCman on you WordPress website. Yuck!

How?

Writing your own translations overrides is super simply. First you need to create a folder for enabling the language overrides:


SITE_ROOT/wp-contents/foliolabs/translations/docman

Inside this folder you will additionally create a language folder following the ISO 639-1 code guidelines (two letters abbreviation). For example for english you would create a en folder followed by a en.php file inside:


SITE_ROOT/wp-contents/foliolabs/translations/docman/en/en.php

The translation override file contains a PHP array with key => values corresponding to the translation key with its corresponding translation as the value:


<?php
 return [
    'search for documents' => 'Look for documents',
    'search in' => 'inside'
 ];

In this example we have two translations being overridden. These two keys ('search for documents' and 'search in') get used on the DOCman search block, and we are effectively changing their original values ('Search for documents' and 'Search in' respectively).

DOCman's original translation files are located at:


SITE_ROOT/wp-contents/plugins/foliolabs-docman/base/resources/language

From here you can grab the keys you would like to override based on their values and then start adding your own translation overrides following the procedure exposed above.