Doug Lawrence

I enable global growth

International

  • English

  • русский

  • 中文

Connect

  • Facebook

  • Twitter

  • Google+

  • LinkedIn

  • Pinterest

  • Skype

  • YouTube

  • Instagram

  • Slide Share

  • ВКонтакте

  • Xing

  • Одноклассники

  • Viadeo

  • Профессионалы.ru

  • 微信

  • QQ

  • 人人

  • 新浪微博

  • Snap Chat

  • You Ku

  • Home
  • Global Selling
    • Selling Internationally Courses
      • Sales negotiation in an international context
      • Maximizing your impact at international industry events
    • International Strategy Consulting
    • International Sales Training
    • Sales Training for Translation Providers
  • Global Web
    • Global Web
    • Multilingual WordPress
    • Translation Technologies
  • Export Comms
    • UKTI Export Communications Review Service Archive Page
    • West Midlands Export Communications Review
    • International Communications Review
    • Translation Technologies
  • Selling Translations
    • ATC ISO Certification Service
    • About
    • Translation Companies
    • Freelancers
    • Selling Translations Events
    • Selling Translations Courses
    • On-line Courses
    • Testimonials
    • Related blog posts
    • Sign up to the Selling Translations Newsletter
  • Blog
    • Events
    • Language related
      • О России и русском языке
      • Arabic | العربية
      • 中文
  • About
    • About me: Doug Lawrence
    • Meet the Team
    • General and Legal Information
  • Speaking
    • Speaking
    • Speaker Kit
  • Contact
    • Contact
    • Sign up to my newsletter
You are here: Home / WordPress / Multilingual WordPress / Setting WordPress Multisite Locale

Setting WordPress Multisite Locale

July 13, 2013 By Doug Lawrence

Setting WordPress Multisite Locale

I’m running an English install of WordPress multisite with a few sites in languages other than English. I was dismayed see that multisite appeared to set the locale to en_US (English for the United States) for these non-English sites.

 

source-code-before-locale-setter

Source code before locale setter

 

Mike Little helped me to implement the following code to fix this:

<?php 

add_filter('locale','sitename_locale');
function sitename_locale($locale){  
global $current_blog; if (is_admin ()) // if this is the admin back end don't change the locale 
return $locale; if ('7' == $current_blog->blog_id){  // 7 is the site id for real men drink milk
return 'en_GB';
}else
if ('15' == $current_blog->blog_id){ // 15 is the site id for doug lawrence UAE
return 'ar_AE';
}else if
('5' == $current_blog->blog_id){ // 5 is the site id for douglawrence.cn
return 'zh_CN';
}
return $locale;
}

 

source-code-after-locale-setter

Source code after locale setter

 

The locales I used are:

en_GB   English for Great Britain

ar_AE    Arabic for the United Arab Emirates (to agree with the ccTLD of my Arabic domain)

zh_CN    Chinese for China (as opposed to other countries where Chinese is used)

 

The php file was uploaded to the /httpdocs/wp-content/mu-plugins directory using FTP.

External links to other locale information:

http://wordpress.stackexchange.com/questions/52419/setting-wplang-from-a-plugin

http://wordpress.org/plugins/admin-in-english/.

Filed Under: Multilingual WordPress

Trackbacks

  1. Setting locale and rtl for an Arabic WordPress website on an English install says:
    October 3, 2016 at 9:35 am

    […] This was done as explained in the post setting locale in WordPress Multisite. […]

Testimonials

Client testimonials are important to me. I'm very grateful for clients choosing my services and their feedback which helps me and my team to continually develop our offerings. Courses and workshops run across the globe as in-company, conference workshops, or on-line events. Call us on +44 (0) 1562 746632 or email mail[@]douglawrence.com to discuss how our courses and workshops can help your organisation.

Sales Training for Translation Providers

Selling Translations® is the World’s leading professional Translation Industry Sales Training. Over 6,000 translation industry professionals from more than 120 countries have completed our courses either in-person or on-line. Topics include sales strategy, the translation industry, basic and advanced selling techniques, and account management.

Advancing your Freelance Translation Career is aimed at translators who have been freelancing for some time and want to focus on finding premium work with high-quality agencies and direct clients.

Useful information

  • Contact details
  • Newsletter signup
  • Upcoming events
  • Terms and conditions of supply
  • Website usage terms and conditions
  • Privacy, cookies, and GDPR
Copyright Doug Lawrence © 2019 · Hosted at Pressjitsu.com · Log in · Intranet · Privacy, cookies , and GDPR · Legal