• 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 - 16 through 30 (of 31 total)
  • If you use

    if ( function_exists ( 'the_msls' ) ) the_msls();

    it should print the “right” flags or better: it reflects your setup.

    The translations works in this way:

    In /wp-content/languages/ you’ll find the translation-files of the WordPress-Core (if installed) which lets you choose the language in General > Settings.

    There is also a plugin which is quite useful for this:
    WP Native Dashboard

    In /wp-content/themes/YOURTHEME/languages you can store the language-files for your theme.

    The language-code for spanish is es_ES by the way.

    Thread Starter Aureola

    (@aureola)

    I think I know what’s wrong. Following the tutorial for translating themes, the first step is to add this row to functions.php:

    function my_theme_setup(){
        load_theme_textdomain('mytextdomain', get_template_directory() . '/languages');
    
    }

    Now, the get_template_directory function points to my theme’s folder; so in functions.php I tell wp that my language files are here: mytheme/languages.

    But the MSLS plugin wants the languages folder to reside in wp-content; correct?

    But how do I change get_template_directory() function to “wp-content” directory?
    Or is it possible to change the path to the languages folder in the plugin’s file..?

    Thread Starter Aureola

    (@aureola)

    We must have posted at the same time =)

    Aha, so it’s just the wordpress core files I can change with General -> Settins… this is not what I want. I don’t want a native dashboard either. I just want the visitors of the site to be able to choose between english and spanish site; not the administrative personnel, they only know english and so the back-end should only be in english.

    My files are named es_ES.po and es_ES.mo respectively.

    See my post above, I think that’s where the problem is; the plugin looks for the language files in wp-content/languages as I interpret you in this thread: https://www.ads-software.com/support/topic/site-language-does-not-appear-in-geneal-settings-of-each-site?replies=4, whereas in functions.php the textdomain is loaded to my theme’s directory′s languages folder. Or maybe your answer in that thread concerns only the core language/the back-end/admin panel..?

    I moved the languages folder back to my theme’s folder, but I’m just back on square 1 again, no spanish language turns up.

    But you must of course set the language for every blog once in Settings > General (so these file should be there). After that WordPress will use the language you configured for this blog. So if you set Spanish in one blog it will take automatically the Spanish translation for the theme too. The plugin looks also for the language you set so everything depends on that…

    In your theme you can than write in your functions.php

    function aurelia_setup() {
        load_theme_textdomain(
            'aurelia',
            get_template_directory() . '/languages'
        );
    }
    add_action( 'after_setup_theme', 'aurelia_setup' );

    Change ‘aurelia’ to another value if this is not your textdomain.

    Thread Starter Aureola

    (@aureola)

    Thanks and I finally have a break-through! ??
    After having read through the smashingmagazine linke once more, I discovered a discrepancy between this load function in functions.php, but not where I had looked before. I have built this theme “on top” of a stripped twenty-twelve. And the tutorial told me to look for the row
    add_action('after_setup_theme', 'my_theme_setup');
    and there add the rows I have already written;

    function my_theme_setup(){
        load_theme_textdomain('mytheme', get_template_directory() . '/languages');}

    The problem was that the stripped theme I was using had something else as the second parameter for add_action; my_theme_setup was “migration_setup_something”, and I never changed that. So when I wrote function my_theme_setup() it didn’t match the add_action parameter.
    I changed that second parameter to match the function name, and now it works! I’m not really sure on how MSLS plugin plays part in this whole thing though, but I will try to learn more about how it works. I can’t tell you how happy I am. Thank you so much for your support.

    OK. Very good. You’re welcome…

    Thread Starter Aureola

    (@aureola)

    Hello again,
    I have been struggling with this on the live server now for a while; until I realized that nothing will work unless I have the languages folder in the wp-content folder (For safety reasons now I have two; one in wp-content, one in the theme folder). Until then none of my translations worked; visiting domain/sp just showed english language, and I could not select Spanish/Castilian in General – Settings, it wasn’t available.
    But now it is. However: Although the spanish site detects the english “sister” site very well; the english site seem to be totally oblivious to the spanish site. When I go to the english site’s pages list, I don’t see any translation icons, and when I go to an english Page, I see this: “You should define at least another blog in a different language in order to have some benefit from this plugin!”
    I found another similar question (but I believe no site worked for them?) here: https://www.ads-software.com/support/topic/doesnt-detect-the-different-sites where you also present a workaround; would this work for me too? If so, where do I paste this piece of code; into functions.php or some of the plugin’s files?

    So close now… I would hate to roll back everything. I so hope you can help me this one last step.

    Hello,

    do you have different users for these installations?

    Cheers,
    Dennis.

    Thread Starter Aureola

    (@aureola)

    Hi Dennis and thanks for getting back to me on this. The super-admin is the same for the two blogs, but WP created a site-admin called “sp” for the sp subfolder (the spanish site). This “sp” was the only admin for the spanish site from the start; I had to manually add the super-admin to the sp site as administrator but I did this in the very beginning, as soon as I had finished the multisite conversion.

    Sorry if I don’t get it. There are 2 admins now for the sp-blog and just 1 for the other blog, right? If so you could try to add the other admin too so these blogs have the same administrators.

    Thread Starter Aureola

    (@aureola)

    Yes that was the case! After reading your answer here I changed it so that the same admins are on the two sites and Yes! It finally works! Thank you very much! Contribution on the way.

    OK, very good. The current version Multisite Language Switcher uses the wordpress-function get_blogs_of_user to get all admin’s blogs of the current blog which can lead to such behaviour of the plugin.

    Thread Starter Aureola

    (@aureola)

    I see. This might be something worth mentioning in the installation doc perhaps ??
    Now I only need to figure out how to make conditional URL’s in the footer (links to Conditions of Use and similar footer-links that should direct to different pages depending on language) but that’s another topic. Then I’ll be completely done! ??

    I would use the WordPress navigation menus for this so every blog can have it’s own menu.

    Cheers,
    Dennis.

    Thread Starter Aureola

    (@aureola)

    But my footer – where this menu would then be put – is a template file and I have no idea where to put this footer-navigation into it so that it depends on which language is currently being used.
    (I don’t want to put the footer-stuff into the main navigation menu, that would totally break the layout and making the main navigation too big (it would break into two rows and that would be u g l y ))

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