WordPress.org

Ready to get started?Download WordPress

Forums

multi site for multi languages (11 posts)

  1. moazbasha
    Member
    Posted 1 year ago #

    Hello
    I have some question
    1- Can I use multi sites to make two sites one is English and another is Arabic site by using po/mo files ??

    2- what is better for multi sites, subdomain or subfolder??

    3- Both subfolder and subdomain are required me to do special setting in my cPanel or both are just virtual site??

    4- what is the best - make two sites by two database or - make two sites by using multisites ??

    Thank you

  2. sunil.ch
    Member
    Posted 1 year ago #

    Hello moazbasha,

    If you are working on wordpress then use one domain, one folder, one database..
    for this use WPML plugin, it is a multilanguage plugin for wordpress having the functionality for multiple languages by using .po, .mo files..

  3. moazbasha
    Member
    Posted 1 year ago #

    Thanks for reply
    I have tried this plugin before but I didn't like it because for arabic site some contents of theme must be at right side (rtl)
    WPML plugin doesn't support modify CSS for each language therefor I must make two sites. To make special CSS for each site

    My question is if I can make two sites by two languages by po/mo files using multi sites

  4. Denish
    Member
    Posted 2 months ago #

    @moazbasha

    how did you manage this?
    Currenlty i have same situation like you.
    if I can make two sites by two languages by po/mo files using multi sites?

  5. moazbasha
    Member
    Posted 2 months ago #

    I have tried two solution & I prefer WPML Plugin

    You can use multisites or WPML plugin
    http://codex.wordpress.org/WordPress_in_Your_Language

  6. Denish
    Member
    Posted 2 months ago #

    i choose multisites instead of WPML. now only one help needed.

    How to call different PO/MO files for theme based on different sites in multisite.

    for e.g
    German -- de_DD.mo
    Nedharland - nl_NL.mo

    But over here in wp-config.php -- i can set only one language in 'WP_LANG' options for main language.

  7. moazbasha
    Member
    Posted 2 months ago #

    From My wp-cnfig.php file

    define('WPLANG', '');

  8. If you want each site to have it's own language, you can use PHP if-checks in your wp-config:

  9. If you want each site to have it's own language, you can use PHP if-checks in your wp-config:

  10. If you want each site to have it's own language, you can use PHP if-checks in your wp-config:

    if ( $_SERVER["HTTP_HOST"] == "domain-en.com" ) { define('WPLANG', 'en_us'); }
    
    if ( $_SERVER["HTTP_HOST"] == "domain-nl.com" ) { define('WPLANG', 'NL_nl'); }

    And so on.

  11. Denish
    Member
    Posted 2 months ago #

    @Ipstenu - Mike
    Finally i solved it, I am sharing this so it might be useful for someone

    @Mika, The way you are doing will not work for multisite:
    Because:

    If you see the function at wp-includes/i10n.php

    function get_locale() {
        global $locale;
    
        if ( isset( $locale ) )
            return apply_filters( 'locale', $locale );
    
        // WPLANG is defined in wp-config.
        if ( defined( 'WPLANG' ) )
            $locale = WPLANG;
    
       // If multisite, check options.
        if ( is_multisite() ) {
            // Don't check blog option when installing.
            if ( defined( 'WP_INSTALLING' ) || ( false === $ms_locale = get_option( 'WPLANG' ) ) )
                $ms_locale = get_site_option('WPLANG');
    
            if ( $ms_locale !== false )
                $locale = $ms_locale;
        }
    
        if ( empty( $locale ) )
            $locale = 'en_US';
    
        return apply_filters( 'locale', $locale );
    }le', $locale );
    }

    This function assumes, that if you have multiple websites and one wp-config.php, then this variable should be loaded from the database under totally different name $locale.

    So be careful and remember that after installing WordPress multisite, translation files are loaded according to the site meta WPLANG, which is saved in DB. And don’t try to update this value from the admin panel, because it is buggy and does not work. Just go to the database with phpmyadmin and change the value there.

  12. How would that not work?

    Don't set locale globally, set it per-site.

Topic Closed

This topic has been closed to new replies.

About this Topic