• Resolved Aureola

    (@aureola)


    Hello everyone,

    I would like to do something that I thought would be very common, yet I don’t really find a tutorial that is useful for me. (I don’t need to have a bilingual wordpress installation where the admin panel is in different languages; I don’t need anything translated for me, etc)

    I have made a custom theme from a stripped Twentytwelve; with very few additions such as registered some menus in functions.php and a few custom templates for the pages and the blog page. Now because I need this site to be bilingual, I transformed the site into a multisite, and created the spanish site next to the ordinary english one.
    I also installed the plugin Multisite Language Switcher, after having read numerous tutorials and suggestions on this. But actually, I’m still not sure if I can make use of this plugin?

    In my template files I have some english words, such as “Read More” after the post excerpt in the sidebar. The entire footer.php contains english language. And what concerns the navigation menus; I guess I can just register another set of menus in functions.php and enable them in the spanish website’s admin panel?

    This all boils down to three simple questions:

    1, Do I need the MSLS plugin?
    2, If I do need MSLS, do I still have to create custom templates for the spanish language? (for example, the footer.php)
    3, If so, then what do I name them? My template files all have names such as page.php, home.php, footer.php and so on; as these names have a place in the loop; so if I for instance create a copy of the footer , I guess I can’t just name it footer-sp.php?

    Maybe the solution for me would be to make a child-theme instead?

    I would very much appreciate if anyone could point me in the right direction.

Viewing 15 replies - 1 through 15 (of 31 total)
  • After installing the language files (WordPress and your theme) you can choose the language of every blog in General > Settings. At this point you should already see the advantage to use a multisite for a multilingual website. There is – in most cases – no custom template needed.

    You just need MSLS at if you want to create relations for the various translations and show these as links for your visitors.

    Cheers,
    Dennis.

    Thread Starter Aureola

    (@aureola)

    Hi Realloc,
    I think you might need to see my site so you understand what I mean:
    https://www.ct-equestrian.com/wp/wordpress/

    Look at the footer: This is footer.php:

    </div><!--end mainContent  -->
    </div><!--end container  -->
    </div> <!--end gridcontainer clearfix  -->
    <div id="bottomContainer">
    <div id="footer">
    		<section class="footer-section">
            <h1>About CT Equestrian</h1>
             <ul>
      		<li><?=date('Y')?> Copyright </li>
                 <li><a href="#"> About us </a></li>
      			<li><a href="#"> Terms of Use </a></li>
      			 <li> <a href="#"> Privacy policy </a></li>
      			</ul>
                </section>
            <section class="footer-section">
            <h1>Attend CT Equestrian</h1>
             <ul>
        		 <li>Address:<br> adress.. <br>2blabla<br> </li>
                 <li>Tel:  41201<br>ca+46 (0)70 6193639</li>
                 <li><a href="#">Contact Us</a></li>
                 <li><a href="mailto:[email protected]">E-mail us</a></li>
        	 </ul>
             </section>
             <section class="footer-section">
            <h1>Credits</h1>
             <ul>
        		 <li>Designed & developed by nn</li>
                 <li>nn</li>
                 <li>nn</li>
        	 </ul>
             </section>
      </div><!--End footer-->
    </div>
    <?php wp_footer(); ?>
    
    </body>
    </html>

    You see..? A lot of english language here that need to be in spanish. Or how would MSLS be able to help me with this..?
    Another problem is the “Read More” that I have in the sidebar (this is defined in functions.php.

    I have now created a child theme, where I have placed the translated footer.php, etc.. I’m still open to use MSLS but I need to understand how it works, in my case. Does it make a copy of the template files that I can “fill in” with the translated text?

    Big thanks again for helping me out! ??

    OK. In my opinion you should prepare your theme for the localization first. The string

    <h1>About CT Equestrian</h1>

    for example should be written as

    <h1><?php _e( 'About CT Equestrian', 'aureola' ); ?></h1>

    where ‘aureola’ could be the textdomain of your choice. Read on here: https://wp.smashingmagazine.com/2011/12/29/internationalizing-localizing-wordpress-theme/

    MSLS is the glue which sticks the websites together. You can of course create a theme per every language and then make the relations of the translations but I personally prefer the way above.

    Cheers,
    Dennis.

    Thread Starter Aureola

    (@aureola)

    I have read about this localization “thingy” but to tell you the truth; it feels like I would bite off more than I can chew. I’m very very new to php coding and have just started learning it. The problem I have, to begin with, with the __() and the _e() is that I don’t see the next step: What happens when I “send them off” with these special characters – do they end up in some kind of container waiting for me to “grab” them and put them in a .po file or something like that..?
    And for which elements would I need to do this; for every piece of text I want translated..? That will be awful lot. seems to me it is much easier and quicker to just create a child-theme that uses the same php-files with the exception of those that have english text in them – these I copy and put in the child theme’s directory and translate them to spanish.
    I would love to learn the localization stuff but I’m also running out of time cause I promised them to try to be ready by the end of the month, so I need to get this to work real soon.
    Thank you once more for your patience, although I’m just a n00b ??

    No problem. ??

    The next step would be the use of poEdit. The article [which I linked above] is talking about this editor too. You translate just the strings which were hard-coded in your theme (but I have no idea if that is really that much). There would be a big advantage anyway for your future development on the theme when you have to change just one version.

    Thread Starter Aureola

    (@aureola)

    You translate just the strings which were hard-coded in your theme

    Ahh! No that is not so much. Well, the footer contains some li, p and H1/H2 that I guess need to be “sent off” to the po-file.

    But then the multisite activation was all in vain? I guess this translation is made by the po-file “on the fly”, and it doesn’t care about my two sites or where I store the different translations template files..?

    ( I have read the article but that was an entire day ago, and since then I have been diving into child-theme problems, because I figured it was to unclear to me what to do. But now I just might give it another shot).

    When you have finished the translation you can just use the same theme for the Spanish and the English website. WordPress uses the right translation-file automatically regarding the configuration in “General > Settings”.

    Thread Starter Aureola

    (@aureola)

    See, here’s where I feel lost again. How does WordPress know which translation to use? What will I see in General > Settings?
    How can the visitor choose which language to use?

    Thread Starter Aureola

    (@aureola)

    Or maybe you mean that THIS is where MSLS plugin comes in handy! ??
    ?

    Do you know this Wiki here? ->

    https://github.com/lloc/Multisite-Language-Switcher/wiki#howto

    The installation part is interesting at this point.

    Thread Starter Aureola

    (@aureola)

    Yes I have read it, but have not been able to figure out whether or not I can use the plugin. But I guess that that’s what you are saying ??
    So, my to-do list would now be:

    1. Internationalize by “re-tagging” every hard coded piece of text into <?php _e()…. (I will check the syntax of course)
    2. Translate the texts in the PO Editor – here I will see a list of all the text I “sent” here in step 1, so I just add the translation
    3. Save the translations in a .po file in my theme folder
    4. Go to Network Admin, Plugins, and here Network Activate the MSLS plugin, and then, by some magic ;), the plugin will detect when to use what language from the .po-file. I will just have to trust that it will work somehow =)
    Correct?

    You are very close … ??

    1. _e or __ and so on…
    2. poEdit scans your files with the right configuration.
    3. poEdit generates also a .mo-file which is important too.
    4. Add some lines of php-code to the functions.php where you tell WordPress where are your translation-files.
    5. Configure the language in General > Settings in every website.
    6. Activate MSLS and enjoy your work.
    Thread Starter Aureola

    (@aureola)

    Realloc: I am eternally grateful for all your help! I’ll let you know how it goes. Thank you so much!

    Thread Starter Aureola

    (@aureola)

    Hi again,
    I did as you suggested and finally added this to the header.php:
    if ( function_exists ( ‘the_msls’ ) ) the_msls();

    And it turns up fine in the header. But the flag is not correct. I see this field: “Custom URL for flag-images” – I guess this is where I should add the path to the spanish / english flags; but I can’t get it to work. Since it adds https:// to the beginning, I figure I need to write the absolute URL here? As for now it would be https://localhost/wordpress/sp/wp-content/plugins/multisite-language-switcher/flags/es.png&#8221;
    I tried that and nothing changes; still the american flag.

    Edit: Anyway I try to click the spanish flag, but it doesn’t show any translations, everything is still in the original language.

    Thread Starter Aureola

    (@aureola)

    I don’t mean to spam, but this is what I have tried so far:

    1. I read another forum thread and figured the languages folder need to be in the /wp-content folder, not the theme’s folder as they described in a tutorial I followed. So I moved it there. But still no luck.

    2. I went to General ->Settings ->Site Languages, there I have three “languages”, not two, for some reason there is english, spanish/Castellano and “ct” – I figured this was where my translated files were, but no. If I select the spanish/castellano then at least the flag turns correct. But it doesn’t seem to find my languages folder with the translation files.

    3. After having read this thread:
    https://www.ads-software.com/support/topic/plugin-multisite-language-switcher-new-to-multisite-and-using-with-wordpress-33?replies=39 I tried to uninstall the plugin, then reinstall and this time I did not Network Activate, but instead activated the plugin in each site.
    But it still does not translate to spanish in the spanish site… I don’t actually know what to do now. Hope you haven’t got tired of me yet. Once I get this running I’ll definitely donate. And maybe if you want I could write a litte more extensive “How-to” for newbies. ??

Viewing 15 replies - 1 through 15 (of 31 total)
  • The topic ‘Installed multisite, Plugin MSLS, do I still need create custom page templates?’ is closed to new replies.