Contenu connexe Similaire à Multisite for multilingual (20) Multisite for multilingual2. © 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
3. © 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
4. © 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
5. © 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
6. © 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
7. © 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
8. © 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
9. © 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
10. © 2012 Rick Radko, r3df.com
Setting up a multilingual multisite
Begin with a regular "5 Min" WordPress install
codex.wordpress.org/Installing_WordPress
9
11. © 2012 Rick Radko, r3df.com
New to WordPress 4.0
Language choice on
install!
10
12. © 2012 Rick Radko, r3df.com
4.0 language selection
The moment you click
a language, WordPress
switches to that
language.
Asfd
asdfadsf
11
13. © 2012 Rick Radko, r3df.com
The usual install screens - but in French
12
14. © 2012 Rick Radko, r3df.com
Success! - The dashboard in French
13
15. © 2012 Rick Radko, r3df.com
The website - in French
14
16. © 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
17. © 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
18. © 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
19. © 2012 Rick Radko, r3df.com
Step 2 - Network setup
18
20. © 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
21. © 2012 Rick Radko, r3df.com
Step 3 - Network configuration settings
Add the settings shown in part 1. to your
wp−config.php file.
20
22. © 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
23. © 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
24. © 2012 Rick Radko, r3df.com
Network configuration settings - .htaccess
Replace the original rules
with the new ones from
section 2.
23
25. © 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
27. © 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
28. © 2012 Rick Radko, r3df.com
Adding a site
Add a new site with the path “en”:
27
29. © 2012 Rick Radko, r3df.com
The English site
The English site is URL is:
http://some_domain.tld/en
28
30. © 2012 Rick Radko, r3df.com
The French site
The French site URL is:
http://some_domain.tld
29
31. © 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
32. © 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
33. © 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
34. © 2012 Rick Radko, r3df.com
Multisite Language Switcher installed
33
35. © 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
36. © 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
37. © 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
38. © 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
39. © 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
40. © 2012 Rick Radko, r3df.com
The website in Spanish
39
41. © 2012 Rick Radko, r3df.com
Hold it… that's not Spanish!
40
42. © 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
43. © 2012 Rick Radko, r3df.com
Updated plugins and themes:
42
44. © 2012 Rick Radko, r3df.com
The theme now displays correctly
43
45. © 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
47. © 2012 Rick Radko, r3df.com
WP Native Dashboard Fix.
Plugin on Github:
github.com/r3df/r3df-wp-native-dashboard-fix
46
48. © 2012 Rick Radko, r3df.com
Remove /blog on the main site
A quirk of multisite:
the main site is forced to have /blog in the path for
the posts.
For a site with posts (a blog) called something
else, like “news”:
Editing it out of the permalinks in:
Network Admin -> Site->Settings - is not safe
Often reset unintentionally.
Plugin on Github to fix it:
github.com/r3df/r3df-multisite-blog-slug-remover
47
49. © 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
50. © 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