Translation of texts entered in backend
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
As a next step you need to install translating plugin Loco translate https://wordpress.org/plugins/loco translate/
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.
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
Leave a Reply
You must be logged in to post a comment.