This tutorial is intended for experienced WordPress users

Translation of texts entered manually in back-end is not an easy task. Because the texts are not part of the source code they are also not prepared for translation. For this case I have created so called “proxy texts”.  The whole translation of manually entered texts then uses a small hack of WordPress itself. The hack uses a WordPress feature — the texts are translated always even into the default site language. So you will create a translation into the default language of the site.

So for example you want to enter some prefix text before the recalculated price. The default language of the site is English (United States). You will use the field “Recalculated price prefix text” and want to insert there a text “Unit price:” but as this text is not in the source code you need to use the proxy text, which I already planted there: “recalc-prefix-1“. Then you will translate this text into English as “Unit price:” and then let’s say into my native language Czech as “Jednotková cena:“. This way you can translate all entered texts. The list of proxy texts will be on the end of this article. There is five of them for each field.

Example of the translation

First thing is to check the default language of the site. You can find it under Settings-> General -> Site language

In this tutorial it is English (United States)

Then we will prepare the product itself with the “proxy text”. In this case we will be translating field Recalculated price prefix text and the one of proxy texts is recalc-prefix-1 so we will enter this text into the field

As you can see on the front-end right now there is just untranslated proxy text.

As a next step you need to install translating plugin Loco translate https://wordpress.org/plugins/loco translate/

Then you will start to translate the plugin. The quickest way to go there is to go to Plugins->WooCommerce Price per Unit PRO and click Translate

In the next step we will add the new language English (United States)

You will find it among installed languages

You need to select location of the translated file. The most recommended option is to choose Custom location as this file will never be overwritten, but then the plugin Loco translation have to be activated. If you choose System the translating plugin can be deactivated or even deleted when you will finish your translation. Do not choose Author though as this file can be overwritten by some translation made by me.

Then we will find the proxy text for translation. It can be found directly by its name recalc-prefix-1 or you can also search by the context which is here set to the name of the field Recalculated price prefix text. This applies for all the translatable fields.

Now we will translate the word into Unit price: and this way we will replace its display for the default language.

And as you can see on the front-end it is already replaced.

For other languages just repeat the process with some different language selected for translation. In my case it will be Czech language and the text is Jednotková cena:

And after switching your site into the desired language you can see that it works perfectly.

List of all proxy texts together with other translatable texts, already included in the plug-in

In Bold are names of fields under which you can find it in back-end and then there are actual text for translation

Recalculated price prefix text
‘Unit price:’
‘recalc-prefix-1’
‘recalc-prefix-2’
‘recalc-prefix-3’
‘recalc-prefix-4’
‘recalc-prefix-5’

Recalculated price suffix text
‘recalc-suffix-1’
‘recalc-suffix-2’
‘recalc-suffix-3’
‘recalc-suffix-4’
‘recalc-suffix-5’

Custom unit name
‘piece’
‘box’
‘pack’
‘pair’
‘bunch’
‘litre’
‘unit-1’
‘unit-2’
‘unit-3’
‘unit-4’
‘unit-5’

Preposition for weight unit when using automatic text
‘per%’
‘recalc-auto-prep-1’
‘recalc-auto-prep-2’
‘recalc-auto-prep-3’
‘recalc-auto-prep-4’
‘recalc-auto-prep-5’

General price suffix text
‘without VAT’
‘general-suffix-1’
‘general-suffix-2’
‘general-suffix-3’
‘general-suffix-4’
‘general-suffix-5’

Variations – variable price prefix
‘From:’
‘variable-prefix-1’
‘variable-prefix-2’
‘variable-prefix-3’
‘variable-prefix-4’
‘variable-prefix-5’

Display of the settings in front-end and back-end

General settings responsible for some texts

Front-end with automatic text and custom unit name

Product editor with automatic text and custom unit name

Front-end with manual suffix

Product editor with manual suffix

Front-end of variable product with automatic text and custom unit name