0

I've finally made it to setup a multisite. http://www.jeroenbrugman.com/

Now. There are some things I need to change. Like the button on the contact page. It says "Stuur bericht" on both my sites. How ever, i need it to be Send Message on my english site.

How could I achieve this? Also. I have made a custom link on the artwork pages

http://www.jeroenbrugman.com/portfolio/drogenaaldprenten/ontsteltenis/

"Terug naar Droge Naald prenten" which goes back to the project type category of the artwork. The last part of this link is variable per category. I need to translate this too.

These are basically just strings which need to get edited, so it detects on which site it is and uses that translation.

I hope someone could help me out.

Kind regards

1 Answer 1

0

WP has very good support for this. You will be Internationalizing and then Localizing your theme. Internationalization is often abbreviated as "i18n" because there are 18 letters between the 'i' and the 'n'.

The Codex provides a great reference on what needs to be done here: https://codex.wordpress.org/I18n_for_WordPress_Developers

Much of the work involves wrapping strings with various "__()" functions, providing a way for WP to find the appropriate localized version of a string for each language translation available.

EDIT: OK - based on your comment it looks like you are using a ready-made theme from another author. In the code you provided in your comment __( 'Stuur bericht', 'fluxus' ) shows the theme is built with i18n and localization in mind already. The double underscore function (very basically) takes the given phrase 'Stuur bericht' and looks for a translation under the text domain 'fluxus'.

Your theme very likely has a languages folder with translation files present (.po or .mo) for several languages. Or, the functions were put in the theme so you could easily add your own translation files to the theme without having to code PHP.

6
  • Thanks! WP Will find the right translation for each blog as I set the WPLANG according to the site? Commented Nov 25, 2015 at 17:23
  • ` if ( preg_match('/[contact\-form\-7.+?]/is', $post->post_content) ) { $message_btn = '<a id="send-message" href="#" class="button icon-paper-plane">' . __( 'Stuur bericht', 'fluxus' ) . '</a>';` Is the code for the button. How would I translate this? Im a beginner with PHP so the i18n page is kind of a foreign language for me. Commented Nov 25, 2015 at 17:26
  • my theme only has support for english :( Cant I duplicate the language files. and modify them to Dutch. so my WPLANG = NL will automatically pick this up? Commented Nov 25, 2015 at 18:13
  • Quite possibly that is all you need to do. Create a version for each language you want. In the function example given, the first parameter (the phrase) is used to lookup and reference the translation. Good luck! A quick note to your theme author will likely yield some helpful info as well. They built it with localization in mind based on the code example you provided.
    – jdm2112
    Commented Nov 25, 2015 at 18:28
  • I found out that network admin doesn't actually save my WPLANG there. How can i fix this? Commented Nov 25, 2015 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.