Ready to get started?Download WordPress


Tri-lingual multisite, how to change comments form (10 posts)

  1. gscott
    Posted 3 years ago #

    Hi guys,

    I'm running a trilingual multisite, main site and two sub directories, each one in a different language.I've installed the corresponding 'mo' files in the language folder.I haven't amended the WPlang call in WP-config as I'm not sure if you can add 3 languages there, i understand you can only define 1 language.

    Everything is OK in the admin area, but the default language is still showing up in the comments area..'Leave a Reply', 'Submit comment' etc..

    How can I change these comments to show up in the language that I select for each site?

    Would appreciate any help.

  2. Does the theme itself have language files?

  3. gscott
    Posted 3 years ago #

    Yes, the theme has language files.
    However, I think I have solved the issue. I needed to wrap the strings that weren't getting translated ('Leave a reply', 'No responses' etc.)with a GetText call.
    As so beautifully explained here:

    How to Localise.

    After I did that, however, some things were still showing up in the default language, English in my case.'Leave a reply' was not being translated. So, I decided to check the .po file and see what the transaltor had written. In the .po file 'Leave a comment' was written,whereas in my comments template I had 'Leave a reply' which is why it wasn't translating. I just changed'Leave a reply' to 'Leave a comment' in my comments.php template and voila, everything translated OK, so, if anyone else is having the same issue, check the.po file against your templates, you may have translation discrepencies.

    That being said ,one of my initial doubts still stands.

    Can WPlang be amended for more than one language?
    Like this for example:

    '(WPLANG, array('en_US','fr_FR','es_ES'))'

    As I said, I have 3 languages for my multisite and everything is translating perfectly, but I only have one language defined in WPlang.
    How could this be?

  4. Can WPlang be amended for more than one language?

    no, because you can't show it in three languages at once. There has to be a default.

    If you want users to pick their language on the front side, you'll need to use a plugin like wpml.

  5. gscott
    Posted 3 years ago #

    OK, Thanks for the feedback.

  6. Aga
    Posted 3 years ago #

    If you want users to pick their language on the front side, you'll need to use a plugin like wpml.

    @Andrea_r, isn't there any other way? Must I use the plugin to change the WPLANG for each site (withing WP Multisite)?

  7. Aga
    Posted 3 years ago #

    Actually I've managed with the language switcher without any plugin, inserting in my header.php:

    global $wpdb;
    $current_lang = $wpdb->blogid; //get current blog id
    <ul id="lang-switcher">
    	echo('<li><a ' . (($current_lang  == 1) ? 'class="current"' : '') . ' href="' . get_blog_option(1, 'siteurl') .'">polski</a></li>'. "\n");
    	echo('<li><a ' . (($current_lang  == 2) ? 'class="current"' : '') . ' href="' . get_blog_option(2, 'siteurl') .'">english</a></li>'. "\n");
    	echo('<li><a ' . (($current_lang  == 3) ? 'class="current"' : '') . ' href="' . get_blog_option(3, 'siteurl') .'">deutsch</a></li>'. "\n");

    For each site (pl/en/de), I went to Settings->General and set the field "Site language", appropriate for each language.

    In my theme I have the language subdirectory with en_US.mo and de_DE.mo (pl_PL is my native) files.

    Everything works fine, but maybe I was too creative and that wasn't the right way to manage this?

  8. graleh
    Posted 3 years ago #

    What if the theme does not have lang files?

    I have the same problem with the comment function. It says "leave a reply" and "submit button" but I want it in my own language. I have searched for these sentencies all over the folders, but I cannot find them.

    Where could they be located?

  9. esmi
    Forum Moderator
    Posted 3 years ago #

    Try looking in your theme's function.php file.

  10. gscott
    Posted 3 years ago #

    They should be in comments.php template. Double check it.

    If you theme doesn't have language files then you'll have to get the ones you want.

    You'll have to obtain the mo file for the language that you want (in your case your own language).
    Look for your language here
    WordPress in Your Language and download WordPress in your language. One it has downloaded, open the folder and find the wp-content folder, open that and find the languages folder.Inside that folder are the .mo files and .po files.
    The .mo files are the ones that you need in your theme for translation to work. The .po files are for editing purposes (see my second post above).

    If your theme already has a language folder, then just place these files in it. If it doesn't have a folder then just make one and put these files in it (you could just copy the folder itself).

    See this tutorial:
    How to localise

    Hope that helps.

Topic Closed

This topic has been closed to new replies.

About this Topic