Multisite for multilingual

Post on 03-Jul-2015

709 views 0 download

description

Presentation slides from WordCamp Toronto 2014 talk. This talk is about creating a multilingual WordPress site using WordPress multisite. The talk will cover: the basics of setting up multisite, some plugins to make it easier to create a multilingual site, pros & cons of using multisite for multilingual sites, and some tips and tricks to help with your sites.

transcript

r3df.com lumostech.training

Rick Radko

“Multisite for Multilingual”

WordCamp Toronto November 15th, 2014

hello bonjour

guten tag Hola 你好

helló hej

hallo γειά σου

ciao sveiki halló cześć

alo 안녕하세요

привіт नमस्त hallå

© 2012 Rick Radko, r3df.com

A little bit about me

Rick Radko Software, website and app designer/developer,

trainer, speaker. R-Cubed Design Forge: r3df.com LumosTech Training: lumostech.training Creating custom web sites since 1996 WordPress sites since 2008.

Lead organizer of: WordCamp Ottawa 2013, 2014. The Ottawa WordPress Group.

1

© 2012 Rick Radko, r3df.com

Making WordPress multilingual

In this session I will present: A quick backgrounder on multilingual WordPress

setups. Some new 4.0 language features. How to quickly install WordPress multisite. How to set it up for multilingual sites.

Pros & Cons of multisite for multilingual. Some tips and tricks.

Slides: www.slideshare.net/r3df

2

© 2012 Rick Radko, r3df.com

WordPress is not multilingual!

“WordPress does not support a bilingual or multilingual blog out-of-the-box.”

3

codex.wordpress.org/Multilingual_WordPress

© 2012 Rick Radko, r3df.com

WordPress multilingual set-ups

There are 2 common approaches to multilingual in WordPress: Single site approach: One WordPress site contains all language content.

Multisite approach: One site per language.

Each approach has pros/cons under different circumstances.

4

© 2012 Rick Radko, r3df.com

Single site multilingual

With single site, WordPress needs to manage different language versions of: the content, the menus, the output from: themes, widgets and plugins,

and display them in the right language on every page.

5

© 2012 Rick Radko, r3df.com

More on single site multilingual

Multilingual plugins for single site: WPML $ qTranslate -> no longer supported Use: mqTranslate or qTranslate Plus

Polylang xili-language Babble (github) + more

6

© 2012 Rick Radko, r3df.com

What is multisite?

wordpress.com is a multisite. Multisite sites: Share the same WordPress installation. Themes and plugins are available on all sites by

default. Have separate database tables and media folders. Can share domains (URL's) or have completely

different domains. Appear to be independent sites to site visitors.

7

© 2012 Rick Radko, r3df.com

Multilingual with multisite

Advantages of using multisite for multilingual: Each site is a regular WordPress site. One language per site.

Can easily have different themes. No special tricks needed for sidebars, titles etc. Performance. No custom tables.

Fewer plugin issues with: Multilingual plugins. Other plugins.

Different domains for different languages.

8

© 2012 Rick Radko, r3df.com

Setting up a multilingual multisite

Begin with a regular "5 Min" WordPress install codex.wordpress.org/Installing_WordPress

9

© 2012 Rick Radko, r3df.com

New to WordPress 4.0

Language choice on install!

10

© 2012 Rick Radko, r3df.com

4.0 language selection

The moment you click a language, WordPress switches to that language. Asfd asdfadsf

11

© 2012 Rick Radko, r3df.com

The usual install screens - but in French

12

© 2012 Rick Radko, r3df.com

Success! - The dashboard in French

13

© 2012 Rick Radko, r3df.com

The website - in French

14

© 2012 Rick Radko, r3df.com

Language setting in 4.0

There is a new language setting in 4.0: It's hidden if there are no added languages. English (United States) will always be available as

a choice due to the way WordPress is built.

15

© 2012 Rick Radko, r3df.com

3 quick steps to enable multisite

1. Enable multisite setup. a. Optional: set a non-default permalink structure.

(Settings -> Permalinks) 2. Complete the Network Setup page. 3. Copy the Network configuration settings to the

required files.

2 of the many guides to that detail the full process: halfelf.org/ebooks/wordpress-multisite-101/ codex.wordpress.org/Create_A_Network/

16

© 2012 Rick Radko, r3df.com

Step 1 - Enable multisite setup

In your site's wp-config.php: Before the: /* That's all, stop editing! … */" Add: define( 'WP_ALLOW_MULTISITE', true );

17

© 2012 Rick Radko, r3df.com

Step 2 - Network setup

18

© 2012 Rick Radko, r3df.com

Network setup - key setting

Select sub-directories to get URL's like: my-domain.com/en and my-domain.com/fr

19

© 2012 Rick Radko, r3df.com

Step 3 - Network configuration settings

Add the settings shown in part 1. to your wp−config.php file.

20

© 2012 Rick Radko, r3df.com

Network configuration settings - wp-config.php

Add the settings below the previous line you added, and above the "… stop editing ..." line.

21

© 2012 Rick Radko, r3df.com

Network configuration settings part 2

Add the second section of settings to the .htaccess file. (If one does not exist, create one.)

22

© 2012 Rick Radko, r3df.com

Network configuration settings - .htaccess

Replace the original rules with the new ones from section 2.

23

© 2012 Rick Radko, r3df.com

And, that's it!

When you have completed the edits: Click the login link.

(at the bottom of the settings page) Log back in, and check out the site.

24

© 2012 Rick Radko, r3df.com

Network admin

25

© 2012 Rick Radko, r3df.com

Network Admin -> Sites page

In a multisite, the original site from the WordPress install becomes: The main site, with a Site ID of 1. The path is "/". It's accessed at: http://some_domain.tld.

26

© 2012 Rick Radko, r3df.com

Adding a site

Add a new site with the path “en”:

27

© 2012 Rick Radko, r3df.com

The English site

The English site is URL is: http://some_domain.tld/en

28

© 2012 Rick Radko, r3df.com

The French site

The French site URL is: http://some_domain.tld

29

© 2012 Rick Radko, r3df.com

Another set-up

Alternatively, all “active” sites can be added as sub-sites with a language path: http://some_domain.tld/fr http://some_domain.tld/en Etc.

And we hide the main site: http://some_domain.tld (is not used)

30

© 2012 Rick Radko, r3df.com

Hiding the main site

2 ways to hide the main site: 1. Redirect to one of the language sites: .htaccess code. Redirection plugins (there are lots). github.com/r3df/r3df-multisite-redirect/

2. Use the main site as a language selector by implementing a “splash” page. Governments and large institutions tend to use this

style. My WordCamp Montreal talk from 2013, “Tips and

tricks for building multilingual sites” covers how to do splash pages. (my slideshare and wordpress.tv)

31

© 2012 Rick Radko, r3df.com

Multisite language plugins

These plugins will: Relate content items between the sites. Provide widgets for front-end links between

different language versions of content. In some cases connect the editors in dashboards.

Some plugins: Multisite Language Switcher Multilingual Press Zanto WP Translation More?

32

© 2012 Rick Radko, r3df.com

Multisite Language Switcher installed

33

© 2012 Rick Radko, r3df.com

The site with a language switcher

A couple of plugins from the repository: MslsSelect adds a widget with a selector MslsMenu lets you add selectors to menus

34

© 2012 Rick Radko, r3df.com

Shared media libraries

Normally in multisite each sub-site has it's own media uploads folder. For multilingual this may result in uploading

images etc. multiple times, once to each sub-site. There is a plugin for that: Network Shared Media

35

© 2012 Rick Radko, r3df.com

Issues with multisite for multilingual

Ecommerce can have issues: Selling/booking things with fixed inventories

- can’t share inventories between sites. Physical products. Event registration. Booking Calendars

Overstated “issues”: You need to set everything up 2 times (or more). Menus, plugins, widgets, etc.

Entering content 2 times (or more).

36

© 2012 Rick Radko, r3df.com

Adding languages to WordPress 4.0

To add more languages to the site: Install the plugin

"Language Downloader". Need to use Network

Admin -> Plugins. Go back to any site

dashboard to run the plugin.

37

© 2012 Rick Radko, r3df.com

Language setting in multisite

If all went well, the new language is loaded.

Select Spanish on the main site.

38

© 2012 Rick Radko, r3df.com

The website in Spanish

39

© 2012 Rick Radko, r3df.com

Hold it… that's not Spanish!

40

© 2012 Rick Radko, r3df.com

Add language files for themes & plugins

Under Network Admin -> Updates: Update translations. You need to do

this with the main site set to the language needing updates.

41

© 2012 Rick Radko, r3df.com

Updated plugins and themes:

42

© 2012 Rick Radko, r3df.com

The theme now displays correctly

43

© 2012 Rick Radko, r3df.com

Dashboard language plugins

Dashboard language plugins: Allow you to select a language for the dashboard

separate from the site. Some have per user settings. Some have options for the front-end tool bar. Some have login screen language selectors. Some Plugins (there are more): WP Native Dashboard

wordpress.org/extend/plugins/wp-native-dashboard/

Backend Localization wordpress.org/extend/plugins/kau-boys-backend-localization/

44

© 2012 Rick Radko, r3df.com

WP Native Dashboard

45

© 2012 Rick Radko, r3df.com

Migration tools

qTranslate Cleanup and WPML Import wordpress.org/plugins/qtranslate-to-wpml-export/

WPML2WPMSLS - WPML to Multisite Language Switcher: wordpress.org/plugins/wpml2wpmsls/

WPML to MultilingualPress: wordpress.org/plugins/wpml-to-multilingualpress/

48

© 2012 Rick Radko, r3df.com

Contact

Rick Radko email: wpinfo@r3df.com twitter: @r3designforge

Websites: r3df.com lumostech.training

Slides at: www.slideshare.net/r3df

49